Skip to content
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

fix: reexport the WASIProcExit error so it can be caught when calling exported functions #71

Merged
merged 1 commit into from
Mar 31, 2024

Conversation

HarikrishnanBalagopal
Copy link
Contributor

@HarikrishnanBalagopal HarikrishnanBalagopal commented Mar 31, 2024

So you can do

    try {
      instance.exports.my_exported_func();
      return 0;
    } catch (e) {
      if (e instanceof WASIProcExit) {
        return e.code;
      } else {
        throw e;
      }
    }

…ted functions

Signed-off-by: Harikrishnan Balagopal <harikrishmenon@gmail.com>
@HarikrishnanBalagopal HarikrishnanBalagopal changed the title fix: reexport the WASIProcExit so it can be caught when calling exported functions fix: reexport the WASIProcExit error so it can be caught when calling exported functions Mar 31, 2024
@bjorn3
Copy link
Owner

bjorn3 commented Mar 31, 2024

Makes sense.

@bjorn3 bjorn3 merged commit 177ee05 into bjorn3:main Mar 31, 2024
1 check passed
@bjorn3
Copy link
Owner

bjorn3 commented Apr 8, 2024

Published in v0.2.21

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.

None yet

2 participants