feat(napi): add Error.cause support to napi::Error#2829
Merged
Brooooooklyn merged 2 commits intonapi-rs:mainfrom Aug 5, 2025
Merged
feat(napi): add Error.cause support to napi::Error#2829Brooooooklyn merged 2 commits intonapi-rs:mainfrom
Error.cause support to napi::Error#2829Brooooooklyn merged 2 commits intonapi-rs:mainfrom
Conversation
How to use the Graphite Merge QueueAdd the label ready-to-merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
Error.cause support to napi::ErrorError.cause support to napi::Error
Closed
github-merge-queue bot
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Aug 28, 2025
Made the `this.resolve` / `this.load` error message to contain the
original stacktrace.
**Old Error**:
```
[plugin test-plugin-context]
Error: Errored while resolving "./sub.js" in `this.resolve`. Got GenericFailure, Error: my error.
```
**New Error**:
```
[plugin test-plugin-context]
Error: Errored while resolving "./sub.js" in `this.resolve`.
Caused by:
[plugin test-plugin-context]
Error: my error
at PluginContextImpl.resolveId (/home/green/workspace/rolldown/packages/rolldown/tests/fixtures/plugin/context/resolve/_config.ts:24:19)
at plugin (/home/green/workspace/rolldown/packages/rolldown/dist/shared/src-_iWIzySM.mjs:2706:30)
at plugin.<computed> (/home/green/workspace/rolldown/packages/rolldown/dist/shared/src-_iWIzySM.mjs:3404:18)
```
Related error:
https://github.com/vitejs/vite-ecosystem-ci/actions/runs/16718227301/job/47316318655#step:7:1580
depends on napi-rs/napi-rs#2829
github-merge-queue bot
pushed a commit
to rolldown/rolldown
that referenced
this pull request
Aug 28, 2025
Made the `this.resolve` / `this.load` error message to contain the
original stacktrace.
**Old Error**:
```
[plugin test-plugin-context]
Error: Errored while resolving "./sub.js" in `this.resolve`. Got GenericFailure, Error: my error.
```
**New Error**:
```
[plugin test-plugin-context]
Error: Errored while resolving "./sub.js" in `this.resolve`.
Caused by:
[plugin test-plugin-context]
Error: my error
at PluginContextImpl.resolveId (/home/green/workspace/rolldown/packages/rolldown/tests/fixtures/plugin/context/resolve/_config.ts:24:19)
at plugin (/home/green/workspace/rolldown/packages/rolldown/dist/shared/src-_iWIzySM.mjs:2706:30)
at plugin.<computed> (/home/green/workspace/rolldown/packages/rolldown/dist/shared/src-_iWIzySM.mjs:3404:18)
```
Related error:
https://github.com/vitejs/vite-ecosystem-ci/actions/runs/16718227301/job/47316318655#step:7:1580
depends on napi-rs/napi-rs#2829
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 free
to 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.
Made
napi::Errorto be able to set thecauseproperty. This can improve the error message when passing the error message generated on the JS side back to the JS side from the Rust side (rolldown/rolldown#5596).Does this approach look good? If so, I'll a bit more tests.