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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2350633003: Add Dart_GetStickyError (Closed)
Patch Set: turnidge review Created 4 years, 3 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: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index ff628394146695e41eaba62d2a1ff6699da0a638..ddf29f343980accf3c49b434d761003bcfaf9d5a 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1467,11 +1467,11 @@ DART_EXPORT void Dart_SetStickyError(Dart_Handle error) {
Isolate* isolate = thread->isolate();
CHECK_ISOLATE(isolate);
NoSafepointScope no_safepoint_scope;
- if (isolate->sticky_error() != Error::null()) {
+ if ((isolate->sticky_error() != Error::null()) && !::Dart_IsNull(error)) {
FATAL1("%s expects there to be no sticky error.", CURRENT_FUNC);
}
- if (!::Dart_IsUnhandledExceptionError(error)) {
- FATAL1("%s expects the error to be an unhandled exception error.",
+ if (!::Dart_IsUnhandledExceptionError(error) && !::Dart_IsNull(error)) {
+ FATAL1("%s expects the error to be an unhandled exception error or null.",
CURRENT_FUNC);
}
isolate->SetStickyError(
@@ -1487,6 +1487,19 @@ DART_EXPORT bool Dart_HasStickyError() {
}
+DART_EXPORT Dart_Handle Dart_GetStickyError() {
+ Isolate* I = Isolate::Current();
+ CHECK_ISOLATE(I);
siva 2016/09/22 19:43:54 Other places we use the pattern Thread* T = Thre
+ NoSafepointScope no_safepoint_scope;
+ if (I->sticky_error() != Object::null()) {
siva 2016/09/22 19:43:54 if (I->sticky_error() != Error::null()) {
+ Dart_Handle error =
+ Api::NewHandle(Thread::Current(), I->sticky_error());
siva 2016/09/22 19:43:54 NewHandle(T, ...);
+ return error;
+ }
+ return Dart_Null();
+}
+
+
DART_EXPORT void Dart_ExitIsolate() {
Thread* T = Thread::Current();
CHECK_ISOLATE(T->isolate());

Powered by Google App Engine
This is Rietveld 408576698