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

Unified Diff: runtime/lib/isolate.cc

Issue 9148048: Standardize error printing a bit by moving it to the Error object and (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 11 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
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698