mirror of https://github.com/pyodide/pyodide.git
Be a bit more specific when feature detecting Javascipt errors (#1647)
This commit is contained in:
parent
5d4ff86a7c
commit
2dd41b639b
|
@ -604,7 +604,10 @@ EM_JS_NUM(bool, hiwire_is_comlink_proxy, (JsRef idobj), {
|
||||||
EM_JS_NUM(bool, hiwire_is_error, (JsRef idobj), {
|
EM_JS_NUM(bool, hiwire_is_error, (JsRef idobj), {
|
||||||
// From https://stackoverflow.com/a/45496068
|
// From https://stackoverflow.com/a/45496068
|
||||||
let value = Module.hiwire.get_value(idobj);
|
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), {
|
EM_JS_NUM(bool, hiwire_is_promise, (JsRef idobj), {
|
||||||
|
|
Loading…
Reference in New Issue