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

expose trap error from RuntimeError #2026

Merged
merged 2 commits into from
Jan 15, 2021
Merged

expose trap error from RuntimeError #2026

merged 2 commits into from
Jan 15, 2021

Conversation

ailisp
Copy link
Contributor

@ailisp ailisp commented Jan 15, 2021

Description

Internal of RuntimeError is private, user can know UserError via downcast, but user isn't able to tell the trap code if it's a Trap. This PR expose trap code via RuntimeError#to_trap. (And, if both downcast returns error and to_trap returns None, user will know it's a RuntimeError::Generic, which can be shown by error.message(), so there's no need to expose RuntimeError::Generic case)

Review

  • Add a short description of the the change to the CHANGELOG.md file

@syrusakbary
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Jan 15, 2021
2026: expose trap error from RuntimeError r=syrusakbary a=ailisp

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description
<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

Internal of RuntimeError is private, user can know UserError via `downcast`, but user isn't able to tell the trap code if it's a `Trap`. This PR expose trap code via `RuntimeError#to_trap`. (And, if both downcast returns error and to_trap returns None, user will know it's a `RuntimeError::Generic`, which can be shown by `error.message()`, so there's no need to expose `RuntimeError::Generic` case)

# Review

- [] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Bo Yao <[email protected]>
@bors
Copy link
Contributor

bors bot commented Jan 15, 2021

Canceled.

@syrusakbary
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 15, 2021

@bors bors bot merged commit b4d2d8e into wasmerio:master Jan 15, 2021
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.

2 participants