mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-10 14:16:06 +00:00
Merge pull request #1466 from fitzgen/log-stacks
Log stacks of imported JS functions that throw but aren't marked `catch`
This commit is contained in:
commit
358ee18ab2
@ -716,13 +716,23 @@ impl<'a, 'b> Rust2Js<'a, 'b> {
|
|||||||
try {{\n\
|
try {{\n\
|
||||||
{}
|
{}
|
||||||
}} catch (e) {{\n\
|
}} catch (e) {{\n\
|
||||||
console.error(\"wasm-bindgen: imported JS function that \
|
let error = (function () {{
|
||||||
|
try {{
|
||||||
|
return e instanceof Error
|
||||||
|
? `${{e.message}}\n\nStack:\n${{e.stack}}`
|
||||||
|
: e.toString();
|
||||||
|
}} catch(_) {{
|
||||||
|
return \"<failed to stringify thrown value>\";
|
||||||
|
}}
|
||||||
|
}}());
|
||||||
|
console.error(\"wasm-bindgen: imported JS function `{}` that \
|
||||||
was not marked as `catch` threw an error:\", \
|
was not marked as `catch` threw an error:\", \
|
||||||
e);
|
error);
|
||||||
throw e;
|
throw e;
|
||||||
}}\
|
}}\
|
||||||
",
|
",
|
||||||
&invoc,
|
&invoc,
|
||||||
|
shim,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user