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

Add panic hook #73

Merged
merged 2 commits into from
Feb 4, 2020
Merged

Add panic hook #73

merged 2 commits into from
Feb 4, 2020

Conversation

evgenykuzyakov
Copy link
Contributor

@evgenykuzyakov evgenykuzyakov commented Feb 3, 2020

Added STD panic hook. Now we expose Rust errors from Wasm through panic_utf8:

Examples:

unreachable macro:

Scheduling a call: panic-test.test_panic({})
Error:  TypedError: Transaction Byy8Hg5te6i9LtgCMcg8uVHzHnJmfTKBZJT5Aj7wPnEL failed. Smart contract panicked: panicked at 'internal error: entered unreachable code: AHAHA', src/lib.rs:29:9

invalid arguments:

Scheduling a call: panic-test.set_allowance({})
Error:  TypedError: Transaction 3GE7tCd2bg1GYhgXXUE7Y5wArLXKYujCQ8qvn6mVwjnC failed. Smart contract panicked: panicked at 'called `Result::unwrap()` on an `Err` value: Error("invalid type: null, expected a string", line: 0, column: 0)', src/libcore/result.rs:1084:5

Fixes #72

@evgenykuzyakov
Copy link
Contributor Author

I also need to add a hook for initializer, 1 sec

Copy link
Contributor

@lexfrl lexfrl left a comment

Choose a reason for hiding this comment

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

great!

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.

Expose errors
3 participants