Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: runtime/bin/dartutils.cc

Issue 9657001: Start using Dart_PropagateError in the runtime/bin directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/dartutils.cc
===================================================================
--- runtime/bin/dartutils.cc (revision 5191)
+++ runtime/bin/dartutils.cc (working copy)
@@ -47,7 +47,9 @@
ASSERT(Dart_IsInteger(value_obj));
int64_t value = 0;
Dart_Handle result = Dart_IntegerToInt64(value_obj, &value);
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
return value;
}
@@ -55,7 +57,9 @@
const char* DartUtils::GetStringValue(Dart_Handle str_obj) {
const char* cstring = NULL;
Dart_Handle result = Dart_StringToCString(str_obj, &cstring);
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
return cstring;
}
@@ -63,7 +67,9 @@
bool DartUtils::GetBooleanValue(Dart_Handle bool_obj) {
bool value = false;
Dart_Handle result = Dart_BooleanValue(bool_obj, &value);
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
return value;
}
@@ -74,14 +80,18 @@
Dart_Handle result = Dart_SetField(handle,
Dart_NewString(name),
Dart_NewInteger(val));
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
}
intptr_t DartUtils::GetIntegerField(Dart_Handle handle,
const char* name) {
Dart_Handle result = Dart_GetField(handle, Dart_NewString(name));
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
intptr_t value = DartUtils::GetIntegerValue(result);
return value;
}
@@ -93,7 +103,9 @@
Dart_Handle result = Dart_SetField(handle,
Dart_NewString(name),
Dart_NewString(val));
- ASSERT(!Dart_IsError(result));
+ if (Dart_IsError(result)) {
+ Dart_PropagateError(result);
+ }
}
@@ -140,7 +152,7 @@
// Get the url of the including library.
Dart_Handle library_url = Dart_LibraryUrl(library);
if (Dart_IsError(library_url)) {
- return Dart_Error("accessing library url failed");
+ return library_url;
}
if (!Dart_IsString8(library_url)) {
return Dart_Error("library url is not a string");
@@ -148,7 +160,7 @@
const char* library_url_str = NULL;
Dart_Handle result = Dart_StringToCString(library_url, &library_url_str);
if (Dart_IsError(result)) {
- return Dart_Error("accessing library url characters failed");
+ return result;
}
if (url_mapping != NULL) {
const char* mapped_library_url_str = MapLibraryUrl(url_mapping,

Powered by Google App Engine
This is Rietveld 408576698