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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2223913002: Add an API for setting the sticky error (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: asiva review Created 4 years, 4 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 | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index aff9955d0f6066674e0b6dc52f2389bf321cc290..4f8c0604d9205de1fb5a406367dbdbb11f97a8f0 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1450,6 +1450,32 @@ DART_EXPORT void Dart_SetPausedOnExit(bool paused) {
}
+DART_EXPORT void Dart_SetStickyError(Dart_Handle error) {
+ Thread* thread = Thread::Current();
+ DARTSCOPE(thread);
+ Isolate* isolate = thread->isolate();
+ CHECK_ISOLATE(isolate);
+ NoSafepointScope no_safepoint_scope;
+ if (isolate->sticky_error() != Error::null()) {
+ 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.",
+ CURRENT_FUNC);
+ }
+ isolate->SetStickyError(
+ Api::UnwrapErrorHandle(Z, error).raw());
+}
+
+
+DART_EXPORT bool Dart_HasStickyError() {
+ Isolate* isolate = Isolate::Current();
+ CHECK_ISOLATE(isolate);
+ NoSafepointScope no_safepoint_scope;
+ return isolate->sticky_error() != Error::null();
+}
+
+
DART_EXPORT void Dart_ExitIsolate() {
Thread* T = Thread::Current();
CHECK_ISOLATE(T->isolate());
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698