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

Unified Diff: sky/engine/tonic/dart_error.cc

Issue 926753002: Improve DartLoader error handling. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove saw_error Created 5 years, 10 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: sky/engine/tonic/dart_error.cc
diff --git a/sky/engine/tonic/dart_error.cc b/sky/engine/tonic/dart_error.cc
index 4ef6865437cb481fd3c6ed7f323fc59a5ec98e25..d733c3328a60131644add913abcf50de8fb96190 100644
--- a/sky/engine/tonic/dart_error.cc
+++ b/sky/engine/tonic/dart_error.cc
@@ -18,6 +18,15 @@ const char kInvalidArgument[] = "Invalid argument.";
bool LogIfError(Dart_Handle handle) {
if (Dart_IsError(handle)) {
LOG(ERROR) << Dart_GetError(handle);
+
+ // Only unhandled exceptions have stacktraces.
+ if (!Dart_ErrorHasException(handle))
+ return true;
+
+ Dart_Handle stacktrace = Dart_ErrorGetStacktrace(handle);
+ const char* stacktrace_cstr = "";
+ Dart_StringToCString(Dart_ToString(stacktrace), &stacktrace_cstr);
+ LOG(ERROR) << stacktrace_cstr;
return true;
}
return false;
« sky/engine/core/script/dart_loader.cc ('K') | « sky/engine/core/script/dart_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698