Skip to content

Fix js backtrace attached to ocaml exn #1409

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

Merged
merged 8 commits into from
Feb 18, 2023
Merged

Fix js backtrace attached to ocaml exn #1409

merged 8 commits into from
Feb 18, 2023

Conversation

hhugo
Copy link
Member

@hhugo hhugo commented Feb 16, 2023

Fix #1347

Fix #1045
One can control backtrace recording with OCAMLRUNPARAM env variable

$ OCAMLRUNPARAM=b=0 node ./q.js 12
Fatal error: exception Not_found

$ OCAMLRUNPARAM=b=1 node ./q.js 12
Fatal error: exception Not_found

/js_of_ocaml/q.js:1474
      if(err.js_error) throw err.js_error;
                       ^

Error: Js exception containing backtrace
    at caml_exn_with_js_backtrace (/js_of_ocaml/q.js:31:21)
    at caml_maybe_attach_backtrace (/js_of_ocaml/q.js:36:15)
    at f (/js_of_ocaml/q.js:1560:25)
    at f (/js_of_ocaml/q.js:1563:15)
    at f (/js_of_ocaml/q.js:1563:15)
    at /js_of_ocaml/q.js:1566:12
    at Object.<anonymous> (/js_of_ocaml/q.js:1574:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)

@hhugo hhugo requested a review from vouillon February 16, 2023 16:31
@hhugo hhugo added this to the 5.1 milestone Feb 17, 2023
@hhugo hhugo merged commit 77ad64f into master Feb 18, 2023
@hhugo hhugo deleted the eeee branch February 18, 2023 12:37
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.

Generate an improved backtrace when raising an exception from the runtime [FEATURE REQUEST] enable with-js-error by default?
1 participant