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

unhandled exceptions should render better error messagea #743

Open
avsm opened this issue Nov 16, 2021 · 1 comment
Open

unhandled exceptions should render better error messagea #743

avsm opened this issue Nov 16, 2021 · 1 comment

Comments

@avsm
Copy link
Collaborator

avsm commented Nov 16, 2021

It would be more informative if the compiler output Unhandled_effect <EFFECT_NAME> instead of Unhandled. Also, bonus points for a backtrace of where the perform happened, as happens with exceptions when CAMLRUNPARAM=b.

@kayceesrk
Copy link
Contributor

kayceesrk commented Nov 16, 2021

Also, bonus points for a backtrace of where the perform happened, as happens with exceptions when CAMLRUNPARAM=b.

This is already done as unhandled effects raise Unhandled exception at the point of perform: https://github.com/ocaml-multicore/ocaml-multicore/blob/5.00/stdlib/effectHandlers.mli#L18-L21.

(* foo.ml *)
open EffectHandlers

type _ eff += E : unit eff

let rec foo () =
  perform E;
  foo ()
  [@@inline never]

let _ = foo ()
$ OCAMLRUNPARAM=b ./a.out 
Fatal error: exception Unhandled
Raised by primitive operation at Foo.foo in file "foo.ml", line 7, characters 2-11
Called from Foo in file "foo.ml", line 11, characters 8-14

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

No branches or pull requests

2 participants