-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[EH] Print message for uncaught exceptions #18003
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ef9c5ce
8e29c3b
24b5566
a9d2f3f
ecdef0b
e825db2
8a32e1d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7905,10 +7905,12 @@ def test_wasm_nope(self): | |
self.assertContained('no native wasm support detected', out) | ||
|
||
@requires_v8 | ||
def test_wasm_exceptions_stack_trace(self): | ||
def test_wasm_exceptions_stack_trace_and_message(self): | ||
src = r''' | ||
#include <stdexcept> | ||
|
||
void bar() { | ||
throw 3; | ||
throw std::runtime_error("my message"); | ||
} | ||
void foo() { | ||
bar(); | ||
|
@@ -7921,8 +7923,8 @@ def test_wasm_exceptions_stack_trace(self): | |
emcc_args = ['-g', '-fwasm-exceptions'] | ||
self.v8_args.append('--experimental-wasm-eh') | ||
|
||
# Stack trace example for this example code: | ||
# exiting due to exception: [object WebAssembly.Exception],Error | ||
# Stack trace and message example for this example code: | ||
# exiting due to exception: [object WebAssembly.Exception],Error: std::runtime_error, my message | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated, but I wonder if we could drop the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think It's easy to consistently take out that part, because different engines can have different error formats. For example, d8 prints: exiting due to exception: [object WebAssembly.Exception],Error: std::runtime_error,my message
at __cxa_throw (wasm://wasm/00462286:wasm-function[44]:0x3b0f)
at bar() (wasm://wasm/00462286:wasm-function[9]:0x98c)
at foo() (wasm://wasm/00462286:wasm-function[10]:0x992)
at __original_main (wasm://wasm/00462286:wasm-function[11]:0x9c4)
at main (wasm://wasm/00462286:wasm-function[12]:0x9e1)
at test.js:934:22
at callMain (test.js:1874:15)
at doRun (test.js:1928:23)
at run (test.js:1943:5) Whereas Node prints: /usr/local/google/home/aheejin/test/stack/test.js:147
throw ex;
^
WebAssembly.Exception: std::runtime_error,my message
at __cxa_throw (wasm://wasm/00462286:wasm-function[44]:0x3b0f)
at bar() (wasm://wasm/00462286:wasm-function[9]:0x98c)
at foo() (wasm://wasm/00462286:wasm-function[10]:0x992)
at __original_main (wasm://wasm/00462286:wasm-function[11]:0x9c4)
at main (wasm://wasm/00462286:wasm-function[12]:0x9e1)
at /usr/local/google/home/aheejin/test/stack/test.js:934:22
at callMain (/usr/local/google/home/aheejin/test/stack/test.js:1874:15)
at doRun (/usr/local/google/home/aheejin/test/stack/test.js:1928:23)
at run (/usr/local/google/home/aheejin/test/stack/test.js:1943:5)
Node.js v17.5.0 So while both of them have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving it as is sounds fine for to me then. We can attempt to refine in a followup perhaps. |
||
# at __cxa_throw (wasm://wasm/009a7c9a:wasm-function[1551]:0x24367) | ||
# at bar() (wasm://wasm/009a7c9a:wasm-function[12]:0xf53) | ||
# at foo() (wasm://wasm/009a7c9a:wasm-function[19]:0x154e) | ||
|
@@ -7932,7 +7934,12 @@ def test_wasm_exceptions_stack_trace(self): | |
# at callMain (test.js:4567:15) | ||
# at doRun (test.js:4621:23) | ||
# at run (test.js:4636:5) | ||
stack_trace_checks = ['at __cxa_throw', 'at bar', 'at foo', 'at main'] | ||
stack_trace_checks = [ | ||
'std::runtime_error,my message', | ||
'at __cxa_throw', | ||
'at bar', | ||
'at foo', | ||
'at main'] | ||
|
||
# We attach stack traces to exception objects only when ASSERTIONS is set | ||
self.set_setting('ASSERTIONS') | ||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This second argument is what I should've deleted in #17979 and forgot. (I first added an option in the JS f unction and then deleted it after feedback, but forgot to delete the caller side, which didn't error out)