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

Reify message traps as errors to match platform #1530

Open
crusso opened this issue May 20, 2020 · 0 comments
Open

Reify message traps as errors to match platform #1530

crusso opened this issue May 20, 2020 · 0 comments
Labels
interpreter P3 low priority, resolve when there is time

Comments

@crusso
Copy link
Contributor

crusso commented May 20, 2020

Our interpreters abort on traps instead of propagating them as failure messages.

[nix-shell:~/motoko/test/run]$ rlwrap ../../src/moc
Motoko 0.1 interpreter
> import Prim "mo:prim";
let Prim : module {...}
> let a = async throw Prim.error("foo");
let a : async<$top-level> None = async Error (#canister_reject, "foo")
> let b = async 1/0;
stdin:3.15-3.18: execution error, arithmetic overflow
let b : async<$top-level> Nat = async _
> await b;
> b;
async[1] _ : async<$top-level> Nat
> 

Related to #506.

The fix is probably to maintain an extra trap continuation in the interpreter environment, invoked from the current aborting trap function and PrimE

@crusso crusso added the P3 low priority, resolve when there is time label May 20, 2020
@rossberg rossberg changed the title Intrepreter: reify message traps as errors to match platform Reify message traps as errors to match platform May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter P3 low priority, resolve when there is time
Projects
None yet
Development

No branches or pull requests

2 participants