From 2dd41b639b87e040afa3d7a637631895f9d5f024 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Sat, 19 Jun 2021 01:55:57 -0700 Subject: [PATCH] Be a bit more specific when feature detecting Javascipt errors (#1647) --- src/core/hiwire.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/hiwire.c b/src/core/hiwire.c index 0756fc400..7808fcd25 100644 --- a/src/core/hiwire.c +++ b/src/core/hiwire.c @@ -604,7 +604,10 @@ EM_JS_NUM(bool, hiwire_is_comlink_proxy, (JsRef idobj), { EM_JS_NUM(bool, hiwire_is_error, (JsRef idobj), { // From https://stackoverflow.com/a/45496068 let value = Module.hiwire.get_value(idobj); - return !!(value && value.stack && value.message); + // clang-format off + return !!(value && typeof value.stack === "string" && + typeof value.message === "string"); + // clang-format on }); EM_JS_NUM(bool, hiwire_is_promise, (JsRef idobj), {