-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[EH] Remove 'terminating' from exception message #17058
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 2 commits
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 |
|---|---|---|
|
|
@@ -1608,10 +1608,10 @@ def test_exceptions_rethrow_missing(self): | |
| self.do_runf('main.cpp', None, assert_returncode=NON_ZERO) | ||
|
|
||
| @no_wasm64('MEMORY64 does not yet support exceptions') | ||
| def test_format_exception(self): | ||
| def test_exception_message(self): | ||
| self.set_setting('DISABLE_EXCEPTION_CATCHING', 0) | ||
| self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', ['$formatException', '__cxa_decrement_exception_refcount', '__cxa_increment_exception_refcount']) | ||
| self.set_setting('EXPORTED_FUNCTIONS', ['_main', 'formatException', '_emscripten_format_exception', '_free']) | ||
| self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', ['$getExceptionMessage', '__cxa_decrement_exception_refcount', '__cxa_increment_exception_refcount']) | ||
| self.set_setting('EXPORTED_FUNCTIONS', ['_main', 'getExceptionMessage', '___get_exception_message', '_free']) | ||
| self.maybe_closure() | ||
| src = ''' | ||
| #include <emscripten.h> | ||
|
|
@@ -1652,19 +1652,19 @@ class myexception : public exception { | |
| // the exception, if necessary. By incrementing and decrementing the refcount | ||
| // we trigger the free'ing of the exception if its refcount was zero. | ||
| ___cxa_increment_exception_refcount(p); | ||
| console.log(Module["formatException"](p).replace(/0x[0-9a-f]*/, "xxx")); | ||
|
Member
Author
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. @hoodmane By the way I have a question. Is there a reason we can't call this just like console.log(formatException(p));? The same for
Collaborator
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'm not sure, try it and see?
Collaborator
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. From outside the module you would need
Member
Author
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. Thanks. Changed them to direct calls. |
||
| console.log(Module["getExceptionMessage"](p).replace(/0x[0-9a-f]*/, "xxx")); | ||
| ___cxa_decrement_exception_refcount(p); | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| ''' | ||
| expected = '''\ | ||
| terminating with uncaught exception of type int | ||
| terminating with uncaught exception of type char | ||
| terminating with uncaught exception of type std::runtime_error: abc | ||
| terminating with uncaught exception of type myexception: My exception happened | ||
| terminating with uncaught exception of type char const* | ||
| exception of type int | ||
| exception of type char | ||
| exception of type std::runtime_error: abc | ||
| exception of type myexception: My exception happened | ||
| exception of type char const* | ||
| ''' | ||
|
|
||
| self.do_run(src, expected) | ||
|
|
||
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.
I guess we don't have any current caller of this yet, but we will do soon (perhaps in debug builds, or some opt-in configuration)?
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.
Yes I'd like to use it later, and this PR doesn't have a direct test for this, but I think holding this small piece off is probably not worth it..