Port :erlang.exit/1 to JS #451
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR implements the
:erlang.exit/1function as a JavaScript port for the Hologram project.Closes #450
What Was Done
1. JavaScript Implementation
exit/1function toassets/js/erlang/erlang.mjsHologramExitErrorwith the provided reasonerror/2andfloat/12. New Error Type: HologramExitError
Created
assets/js/errors/exit_error.mjswith a new error class that:3. JavaScript Tests
Added comprehensive unit tests in
test/javascript/erlang/erlang_test.mjs:HologramExitErroris thrown with proper error handlingassert.throwspattern with error constructor4. Elixir Consistency Tests
Added server-side verification tests in
test/elixir/hologram/ex_js_consistency/erlang/erlang_test.exs:Design Decision: HologramExitError
A key design decision was whether to:
The new error class approach was chosen because:
Concerns about this approach:
Feedback on this design decision is welcome. If the maintainers prefer a different approach, it would be straightforward to refactor.
Test Results
✅ All quality gates passing:
Scope Compliance
This PR follows all contribution guidelines:
Implementation Notes
Note: This pull request was implemented using GitHub Copilot. Feedback on code quality, design decisions, and approach is welcome and appreciated.