summaryrefslogtreecommitdiff
path: root/core/libdeno
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-12-19 21:04:14 -0800
committerRy Dahl <ry@tinyclouds.org>2019-12-20 00:04:14 -0500
commit9ef0b18eb0b4c337ccfc8d0add36bec6b657262f (patch)
tree62bc08da0245b8fd7f350480c3ad94319457a7be /core/libdeno
parentfcae4a7c0dc74701f3b1919bfd76cfdc1a0321ed (diff)
repl: do not crash on async op reject (#3527)
Diffstat (limited to 'core/libdeno')
-rw-r--r--core/libdeno/api.cc6
-rw-r--r--core/libdeno/deno.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/core/libdeno/api.cc b/core/libdeno/api.cc
index 1ded39e1b..08e8a6de9 100644
--- a/core/libdeno/api.cc
+++ b/core/libdeno/api.cc
@@ -138,6 +138,12 @@ const char* deno_last_exception(Deno* d_) {
}
}
+void deno_clear_last_exception(Deno* d_) {
+ auto* d = deno::unwrap(d_);
+ d->last_exception_.clear();
+ d->last_exception_handle_.Reset();
+}
+
void deno_execute(Deno* d_, void* user_data, const char* js_filename,
const char* js_source) {
auto* d = deno::unwrap(d_);
diff --git a/core/libdeno/deno.h b/core/libdeno/deno.h
index 946978e3b..fd48abc5a 100644
--- a/core/libdeno/deno.h
+++ b/core/libdeno/deno.h
@@ -117,8 +117,14 @@ void deno_pinned_buf_delete(deno_pinned_buf* buf);
void deno_check_promise_errors(Deno* d);
+// Returns a cstring pointer to the exception.
+// Rust side must NOT assert ownership.
const char* deno_last_exception(Deno* d);
+// Clears last exception.
+// Rust side must NOT hold pointer to exception string when called.
+void deno_clear_last_exception(Deno* d_);
+
void deno_terminate_execution(Deno* d);
void deno_run_microtasks(Deno* d, void* user_data);