Repository navigation
fix(v3): return error to frontend as dedicated Error objects instead of stringified JSON - #5690
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough
ChangesRuntime error handling and docs
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v3/internal/runtime/desktop/`@wailsio/runtime/src/runtime.ts:
- Around line 145-149: The JSON error handling in runtime.ts currently reads
json.message, but this codebase’s error payloads use an error field, so the
branch can still throw an undefined message. Update the response handling in the
runtime request path to use json.error when available, and fall back to
response.text() if the JSON body doesn’t contain a usable error value. Keep the
change localized to the response.json() / Error throw logic so the runtime
behavior remains consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: f19db6a7-cf65-4e39-9cbb-526fdd852050
📒 Files selected for processing (2)
v3/UNRELEASED_CHANGELOG.mdv3/internal/runtime/desktop/@wailsio/runtime/src/runtime.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@v3/internal/runtime/desktop/`@wailsio/runtime/src/calls.ts:
- Line 12: The public Call namespace is losing RuntimeError because calls.ts
only imports it as a type, so the value is not re-exported through src/index.ts.
Update the runtime/calls export path to re-export RuntimeError from runtime.ts
as a value alongside newRuntimeCaller and objectNames, and keep the Call
namespace API intact so Call.RuntimeError remains available from
`@wailsio/runtime`.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4880c6ef-78ea-42a8-a8e3-f8947d7c994d
📒 Files selected for processing (2)
v3/internal/runtime/desktop/@wailsio/runtime/src/calls.tsv3/internal/runtime/desktop/@wailsio/runtime/src/runtime.ts
Expand the Error Handling section of the method bindings docs to cover the new behaviour from wailsapp#5690: failed calls reject with TypeError, RuntimeError or Error based on the error kind reported by the backend, with the Go error message on .message and the serialised Go error on .cause. Add a section on returning custom error types and customising serialisation with ServiceOptions.MarshalError.
The bundled runtime is verified against a clean rebuild of the runtime source by CI, so the calls/runtime changes in this PR need the regenerated bundles committed alongside them. Built with npm ci + task runtime:build:assets per .github/workflows/verify-runtime-assets.yml.
Description
It looks like errors created in the backend are sent to the frontend as well formatted JSON, but the frontend binding call always extracted it as
await response.text(), so I check for the json header and parse it accordingly. Might be worth checking for theCallError.Kindor something but I hit circular dependencies and figured I'd leave it up to discussion.Fixes # (issue)
Type of change
Please select the option that is relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using
wails doctor.If you checked Linux, please specify the distro and version.
Test Configuration
Please paste the output of
wails doctor. If you are unable to run this command, please describe your environment in as much detail as possible.Checklist:
website/src/pages/changelog.mdxwith details of this PR (v3 changelog entries are added automatically)Summary by CodeRabbit
Bug Fixes
application/json), errors are decoded into structured error information (including selecting an error type and preservingcause). Non-JSON failures still surface the full response text.Documentation
error.causestructured error data and theMarshalErroroption for customizing error JSON serialization.