| Index: runtime/bin/main.cc
|
| ===================================================================
|
| --- runtime/bin/main.cc (revision 1469)
|
| +++ runtime/bin/main.cc (working copy)
|
| @@ -98,38 +98,38 @@
|
| static Dart_Handle SetupRuntimeOptions(CommandLineOptions* options) {
|
| int options_count = options->count();
|
| Dart_Handle dart_arguments = Dart_NewList(options_count);
|
| - if (!Dart_IsValid(dart_arguments)) {
|
| + if (Dart_IsError(dart_arguments)) {
|
| return dart_arguments;
|
| }
|
| for (int i = 0; i < options_count; i++) {
|
| Dart_Handle argument_value = Dart_NewString(options->GetArgument(i));
|
| - if (!Dart_IsValid(argument_value)) {
|
| + if (Dart_IsError(argument_value)) {
|
| return argument_value;
|
| }
|
| Dart_Handle result = Dart_ListSetAt(dart_arguments, i, argument_value);
|
| - if (!Dart_IsValid(result)) {
|
| + if (Dart_IsError(result)) {
|
| return result;
|
| }
|
| }
|
| Dart_Handle core_lib_url = Dart_NewString("dart:coreimpl");
|
| - if (!Dart_IsValid(core_lib_url)) {
|
| + if (Dart_IsError(core_lib_url)) {
|
| return core_lib_url;
|
| }
|
| Dart_Handle core_lib = Dart_LookupLibrary(core_lib_url);
|
| - if (!Dart_IsValid(core_lib)) {
|
| + if (Dart_IsError(core_lib)) {
|
| return core_lib;
|
| }
|
| Dart_Handle runtime_options_class_name = Dart_NewString("RuntimeOptions");
|
| - if (!Dart_IsValid(runtime_options_class_name)) {
|
| + if (Dart_IsError(runtime_options_class_name)) {
|
| return runtime_options_class_name;
|
| }
|
| Dart_Handle runtime_options_class = Dart_GetClass(
|
| core_lib, runtime_options_class_name);
|
| - if (!Dart_IsValid(runtime_options_class)) {
|
| + if (Dart_IsError(runtime_options_class)) {
|
| return runtime_options_class;
|
| }
|
| Dart_Handle native_name = Dart_NewString("_nativeArguments");
|
| - if (!Dart_IsValid(native_name)) {
|
| + if (Dart_IsError(native_name)) {
|
| return native_name;
|
| }
|
|
|
| @@ -164,7 +164,7 @@
|
|
|
| // Load the specified script.
|
| library = LoadScript(script_name);
|
| - if (!Dart_IsValid(library)) {
|
| + if (Dart_IsError(library)) {
|
| const char* err_msg = Dart_GetError(library);
|
| fprintf(stderr, "Errors encountered while loading script: %s\n", err_msg);
|
| Dart_ExitScope();
|
| @@ -203,16 +203,6 @@
|
| }
|
|
|
|
|
| -static void PrintObject(FILE* out, Dart_Handle object) {
|
| - Dart_Handle result = Dart_ToString(object);
|
| - if (Dart_IsValid(result)) {
|
| - PrintString(out, result);
|
| - } else {
|
| - fprintf(out, "%s\n", Dart_GetError(result));
|
| - }
|
| -}
|
| -
|
| -
|
| int main(int argc, char** argv) {
|
| char* script_name;
|
| CommandLineOptions vm_options(argc);
|
| @@ -250,7 +240,7 @@
|
| Dart_EnterScope();
|
| if (HasCompileAll(vm_options)) {
|
| Dart_Handle result = Dart_CompileAll();
|
| - if (!Dart_IsValid(result)) {
|
| + if (Dart_IsError(result)) {
|
| fprintf(stderr, "%s\n", Dart_GetError(result));
|
| Dart_ExitScope();
|
| Dart_ShutdownIsolate();
|
| @@ -261,7 +251,7 @@
|
|
|
| // Create a dart options object that can be accessed from dart code.
|
| Dart_Handle options_result = SetupRuntimeOptions(&dart_options);
|
| - if (!Dart_IsValid(options_result)) {
|
| + if (Dart_IsError(options_result)) {
|
| fprintf(stderr, "%s\n", Dart_GetError(options_result));
|
| Dart_ExitScope();
|
| Dart_ShutdownIsolate();
|
| @@ -272,7 +262,7 @@
|
| // Lookup and invoke the top level main function.
|
| Dart_Handle script_url = Dart_NewString(canonical_script_name);
|
| Dart_Handle library = Dart_LookupLibrary(script_url);
|
| - if (!Dart_IsValid(library)) {
|
| + if (Dart_IsError(library)) {
|
| fprintf(stderr, "%s\n", Dart_GetError(library));
|
| Dart_ExitScope();
|
| Dart_ShutdownIsolate();
|
| @@ -284,24 +274,7 @@
|
| Dart_NewString("main"),
|
| 0,
|
| NULL);
|
| - if (Dart_IsValid(result)) {
|
| - if (Dart_ExceptionOccurred(result)) {
|
| - // Print the exception object.
|
| - fprintf(stderr, "An unhandled exception has been thrown\n");
|
| - Dart_Handle exception_result = Dart_GetException(result);
|
| - ASSERT(Dart_IsValid(exception_result));
|
| - PrintObject(stderr, exception_result);
|
| - // Print the stack trace.
|
| - Dart_Handle stacktrace = Dart_GetStacktrace(result);
|
| - ASSERT(Dart_IsValid(stacktrace));
|
| - PrintObject(stderr, stacktrace);
|
| - fprintf(stderr, "\n");
|
| - Dart_ExitScope();
|
| - Dart_ShutdownIsolate();
|
| - free(canonical_script_name);
|
| - return 255; // We had an unhandled exception, hence indicate an error.
|
| - }
|
| - } else {
|
| + if (Dart_IsError(result)) {
|
| fprintf(stderr, "%s\n", Dart_GetError(result));
|
| Dart_ExitScope();
|
| Dart_ShutdownIsolate();
|
| @@ -310,7 +283,7 @@
|
| }
|
| // Keep handling messages until the last active receive port is closed.
|
| result = Dart_RunLoop();
|
| - if (!Dart_IsValid(result)) {
|
| + if (Dart_IsError(result)) {
|
| fprintf(stderr, "%s\n", Dart_GetError(result));
|
| Dart_ExitScope();
|
| Dart_ShutdownIsolate();
|
|
|