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

Use an exception to leave Solving_loop.process_source. #1256

Merged
merged 2 commits into from
Oct 9, 2024

Conversation

Halbaroth
Copy link
Collaborator

@Halbaroth Halbaroth commented Oct 9, 2024

This function cannot call the system call exit because this system call is not supported in browsers (it works in Node).

This commit uses a new exception Exit_on_error and catch it at the toplevel of binaries.

Solve issue #1250

I didn't create a new error in Errors because these errors are caught in Solving_loop to raise Exit_on_error.

@Halbaroth Halbaroth linked an issue Oct 9, 2024 that may be closed by this pull request
@Halbaroth Halbaroth force-pushed the support-exit-on-error-js branch from 3ea8cfc to 721ef01 Compare October 9, 2024 12:23
This function cannot call the system call `exit` because this system
call is not supported in browsers (it works in Node).

This commit uses a new exception `Exit_on_error` and catch it at the
toplevel of binaries.
@@ -32,6 +32,8 @@ module DO = D_state_option
module Sy = Symbols
module O = Options

exception Exit_on_error of int
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also used to exit with a return code of 0, which is not an error — I'd suggest renaming it to Exit_with_code.

@Halbaroth Halbaroth enabled auto-merge (squash) October 9, 2024 14:00
@Halbaroth Halbaroth merged commit 930a13d into OCamlPro:next Oct 9, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supporting exit on error in Javascript mode
2 participants