Uh oh!
There was an error while loading. Please reload this page.
feat: add errorWithName (upstream v6.1.0 parity) - #5
Merged
Conversation
Upstream purescript-exceptions v6.1.0 exports errorWithName :: String -> String -> Error (message first, name second) and the fork did not, so code written against the registry package failed to compile against the fork. The fork models Error as a plain Lua string, so the name is unobservable through this binding: message returns the supplied message and name keeps answering the constant "Error", the same precedent as errorWithCause's dropped cause (documented in the FFI). An observable-name upgrade of the whole Error representation would be a separate issue. The inherited upstream Exception.js gains the same export so it keeps matching its upstream counterpart. Extends the regression guard to pin message/name behaviour, and ignores the dist/ build artifact. Closespurescript-lua/purescript-lua#269
There was a problem hiding this comment.
Pull request overview
Adds upstream purescript-exceptions v6.1.0 API parity by introducing errorWithName :: String -> String -> Error to this PureScript→Lua fork, plus a Lua-side regression guard to pin the fork’s string-Error semantics.
Changes:
- Export
errorWithNamefromEffect.Exceptionand add the corresponding FFI implementations (Lua + JS). - Add a Lua regression test asserting
message (errorWithName msg name) == msgand thatnameremains the"Error"fallback in the Lua backend. - Ignore
/dist/as an additional build artifact directory.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/regression/exception.lua | Adds regression coverage for errorWithName behavior in the Lua FFI. |
| src/Effect/Exception.purs | Exposes errorWithName in the PureScript API surface. |
| src/Effect/Exception.lua | Implements errorWithName for Lua’s string-Error representation (drops name, preserves message). |
| src/Effect/Exception.js | Implements errorWithName in the JS FFI to match upstream behavior (e.name = name). |
| changelog.d/20260714_090000_yura_errorwithname.md | Documents the new API and its Lua-specific observability limitations. |
| .gitignore | Adds /dist/ to ignored build artifacts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Unisay
marked this pull request as ready for review
July 14, 2026 07:30
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closespurescript-lua/purescript-lua#269.
Upstream purescript-exceptions v6.1.0 exports
errorWithName :: String -> String -> Errorand the fork did not, so code written against the registry package failed to compile against the fork. One correction to the issue text: upstream takes the message first and the name second (errorWithName(msg)(name)in the JS FFI), not the other way around; the implementation follows upstream.The fork models
Erroras a plain Lua string, so the name is unobservable through this binding:messagereturns the supplied message andnamekeeps answering the constant"Error", the same precedent aserrorWithCause's dropped cause (documented in the FFI). An observable-name upgrade of the wholeErrorrepresentation stays a separate issue, as scoped in the issue text. The inherited upstreamException.jsgains the same export so it keeps matching its upstream counterpart.The regression guard pins
message (errorWithName msg name) == msgand the documentednamefallback. The whole path is verified:spago buildand the pslua link succeed, and the linked module answersmessage/nameas pinned. The commit also adds/dist/to.gitignore, the same build-artifact gap purescript-lua-console closed in its grouping PR.Follow-up (not in this PR): exceptions fork patch release, then a package-set bump together with the console grouping fix.