Skip to content

[Docs] Add some docs for exception handling JS integration#16403

Open
kripken wants to merge 2 commits intomainfrom
excdoc
Open

[Docs] Add some docs for exception handling JS integration#16403
kripken wants to merge 2 commits intomainfrom
excdoc

Conversation

@kripken
Copy link
Member

@kripken kripken commented Mar 1, 2022

The limitations here came up in discussion with @bkotsopoulossc
Does these docs look helpful?

@kripken kripken requested a review from aheejin March 1, 2022 18:25

No effort is made to bridge the JS and C++ worlds in terms of catching
exceptions from the other side and automatically converting them. That is, you
cannot expect a C++ try-catch to catch a JS exception. C++ can only catch C++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong but I believe there are two big points to make here:

  • C++ can't catch JS exceptions
  • The C++ stack is not unwound correctly if a JS exception bubbles up through it. Destructors are not called

I'd argue that the second one is the really scary one and we should make it super clear to anyone using emscripten EH

Comment on lines +89 to +91
The reason for this is that handling and converting expections by Emscripten
would add significant overhead. If you need such functionality you can add it
at the JS/Wasm layer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the reason is not overhead but that I just didn't have time to do it yet... I think it's OK to say that it is not yet supported but I'm not sure if we want to make it sound like it's a inherent restriction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants