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

Unified Diff: tonic/dart_error.cc

Issue 1244493002: Wholesale move sky/engine/tonic to tonic (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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 | « tonic/dart_error.h ('k') | tonic/dart_exception_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tonic/dart_error.cc
diff --git a/tonic/dart_error.cc b/tonic/dart_error.cc
new file mode 100644
index 0000000000000000000000000000000000000000..971313c91e6598517fa791e428877abc4d03eaa7
--- /dev/null
+++ b/tonic/dart_error.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tonic/dart_error.h"
+
+#include "base/logging.h"
+
+namespace blink {
+
+namespace DartError {
+
+const char kInvalidArgument[] = "Invalid argument.";
+
+} // namespace DartError
+
+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;
+}
+
+} // namespace blink
« no previous file with comments | « tonic/dart_error.h ('k') | tonic/dart_exception_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698