Chromium Code Reviews| Index: runtime/lib/isolate.cc |
| =================================================================== |
| --- runtime/lib/isolate.cc (revision 3212) |
| +++ runtime/lib/isolate.cc (working copy) |
| @@ -53,15 +53,11 @@ |
| } |
| -static void ProcessUnhandledException(const UnhandledException& uhe) { |
| - const Instance& exception = Instance::Handle(uhe.exception()); |
| - Instance& string = Instance::Handle(DartLibraryCalls::ToString(exception)); |
| - const char* str = string.ToCString(); |
| - fprintf(stderr, "%s\n", str); |
| - const Instance& stack = Instance::Handle(uhe.stacktrace()); |
| - string = DartLibraryCalls::ToString(stack); |
| - str = string.ToCString(); |
| - fprintf(stderr, "%s\n", str); |
| +static void ProcessError(const Object& obj) { |
| + ASSERT(obj.IsError()); |
| + Error& error = Error::Handle(); |
| + error ^= obj.raw(); |
| + fprintf(stderr, "%s\n", error.ToErrorCString()); |
|
cshapiro
2012/01/12 00:37:39
Why not use OS::PrintErr instead of fprintf?
turnidge
2012/01/12 19:15:39
Done.
|
| exit(255); |
| } |
| @@ -103,10 +99,8 @@ |
| arguments.Add(&Integer::Handle(Integer::New(port_id))); |
| const Instance& result = Instance::Handle( |
| DartEntry::InvokeStatic(function, arguments, kNoArgumentNames)); |
| - if (result.IsUnhandledException()) { |
| - UnhandledException& uhe = UnhandledException::Handle(); |
| - uhe ^= result.raw(); |
| - ProcessUnhandledException(uhe); |
| + if (result.IsError()) { |
| + ProcessError(result); |
| } else { |
| PortMap::SetLive(port_id); |
| } |
| @@ -178,10 +172,8 @@ |
| result = DartEntry::InvokeStatic(default_constructor, |
| arguments, |
| kNoArgumentNames); |
| - if (result.IsUnhandledException()) { |
| - UnhandledException& uhe = UnhandledException::Handle(); |
| - uhe ^= result.raw(); |
| - ProcessUnhandledException(uhe); |
| + if (result.IsError()) { |
| + ProcessError(result); |
| } |
| ASSERT(result.IsNull()); |
| } |
| @@ -200,18 +192,14 @@ |
| target_function, |
| arguments, |
| kNoArgumentNames); |
| - if (result.IsUnhandledException()) { |
| - UnhandledException& uhe = UnhandledException::Handle(); |
| - uhe ^= result.raw(); |
| - ProcessUnhandledException(uhe); |
| + if (result.IsError()) { |
| + ProcessError(result); |
| } |
| ASSERT(result.IsNull()); |
| free(class_name); |
| result = isolate->StandardRunLoop(); |
| - if (result.IsUnhandledException()) { |
| - UnhandledException& uhe = UnhandledException::Handle(); |
| - uhe ^= result.raw(); |
| - ProcessUnhandledException(uhe); |
| + if (result.IsError()) { |
| + ProcessError(result); |
| } |
| ASSERT(result.IsNull()); |
| @@ -317,11 +305,15 @@ |
| class_name); |
| } |
| const Instance& port = Instance::Handle(SendPortCreate(port_id)); |
| - if (port.IsUnhandledException()) { |
| - ThrowErrorException(Exceptions::kInternalError, |
| - "Unable to create send port to isolate", |
| - library_url, |
| - class_name); |
| + if (port.IsError()) { |
| + if (port.IsUnhandledException()) { |
| + ThrowErrorException(Exceptions::kInternalError, |
| + "Unable to create send port to isolate", |
| + library_url, |
| + class_name); |
| + } else { |
| + ProcessError(port); |
| + } |
| } |
| arguments->SetReturn(port); |
| } |