Skip to content

fix: Preserve the cause of a thrown error in RESTController.handleError - #3149

Open
Stovedal wants to merge 1 commit into
parse-community:alphafrom
Stovedal:fix/preserve-network-error-cause
Open

Stovedal wants to merge 1 commit into
parse-community:alphafrom
Stovedal:fix/preserve-network-error-cause

Conversation

@Stovedal

@Stovedal Stovedal commented Oct 15, 2026 •

Copy link
Copy Markdown

Pull Request

Issue

Network errors are hard to debug due to discarded error cause.

Closes #3150.

Approach

Copy cause onto the ParseError after it is constructed, so it applies to both branches.

Tasks

  • Add tests

Summary by CodeRabbit

  • Bug Fixes
    • Network errors now retain their underlying cause when reported, providing more context about what went wrong. Existing error reporting and rejection behavior remain unchanged.

@parse-github-assistant

Copy link
Copy Markdown

I will reformat the title to use the proper commit message syntax.

@parse-github-assistant parse-github-assistant Bot changed the title fix: preserve the cause of a thrown network error in RESTController.handleError fix: Preserve the cause of a thrown network error in RESTController.handleError Oct 15, 2026
@parse-github-assistant

Copy link
Copy Markdown

🚀 Thanks for opening this pull request! We appreciate your effort in improving the project. Please let us know once your pull request is ready for review.

Tip

  • Keep pull requests small. Large PRs will be rejected. Break complex features into smaller, incremental PRs.
  • Use Test Driven Development. Write failing tests before implementing functionality. Ensure tests pass.
  • Group code into logical blocks. Add a short comment before each block to explain its purpose.
  • We offer conceptual guidance. Coding is up to you. PRs must be merge-ready for human review.
  • Our review focuses on concept, not quality. PRs with code issues will be rejected. Use an AI agent.
  • Human review time is precious. Avoid review ping-pong. Inspect and test your AI-generated code.

Note

Please respond to review comments from AI agents just like you would to comments from a human reviewer. Let the reviewer resolve their own comments, unless they have reviewed and accepted your commit, or agreed with your explanation for why the feedback was incorrect.

Caution

Pull requests must be written using an AI agent with human supervision. Pull requests written entirely by a human will likely be rejected, because of lower code quality, higher review effort and the higher risk of introducing bugs. Please note that AI review comments on this pull request alone do not satisfy this requirement. Our CI and AI review are safeguards, not development tools. If many issues are flagged, rethink your development approach. Invest more effort in planning and design rather than using review cycles to fix low-quality code.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e2bc80c0-7143-413c-ada0-b7df2daa324b
📥 Commits

Reviewing files that changed from the base of the PR and between 560db76 and 009bf42.

📒 Files selected for processing: 2
  • src/RESTController.ts
  • src/__tests__/RESTController-test.js

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

RESTController.handleError now copies a defined cause from an input error to the resulting ParseError. A RESTController.request test verifies that the same cause remains on the rejection.

Changes: Error cause preservation

Layer / File(s) Summary
Preserve and test error causes
src/RESTController.ts, src/__tests__/RESTController-test.js
handleError copies a defined cause to the constructed ParseError. A request test checks that the thrown error’s cause remains on the rejection.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 009bf

REST request failures retain a defined cause without changing their existing ParseError rejection behavior. No actionable merge risk remains.

Security architecture risk: ⚪ Minimal · up to 009bf

The change preserves diagnostic data on existing request errors without changing request authority or rejection behavior. No material security risk was identified in the changed behavior.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated exposure change is additional error data delivered to existing SDK request callers. A configured server can supply that data in an error response, and a transport failure can supply it locally. The inspected change does not establish cross-tenant access, additional privileges, or automatic transmission of the retained cause.

Trust Boundaries and Controls

  • observed — The added operation assigns input data to a fixed cause property on a newly constructed error. It does not evaluate that data or use it for authentication, destination selection, or retry decisions. Existing credential selection and request dispatch are unchanged by the PR.
Pre-merge checks: Passed 7
Passed Passed checks: 7 passed
Check name Status Explanation
Title check Passed The title begins with the required fix: prefix, uses a capitalized first letter after the prefix, and accurately describes the change.
Description check Passed The description includes the required Pull Request, Issue, Approach, and Tasks sections. It explains the problem, describes the implementation, links issue #3150, and confirms that tests were added.
Linked Issues check Passed Issue #3150 requires RESTController.handleError to preserve a thrown network error's cause without changing the existing message and code behavior. At the reviewed head, handleError constructs `…
Out of Scope Changes check Passed The reviewed changes are limited to the RESTController.handleError cause assignment and a focused regression test for preserved network-error causes. Both changes directly support issue #3150. No un…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Security Check Passed No security vulnerability is introduced. The only production change copies an existing errorJSON.cause to the newly created ParseError when it is defined. The cause comes from the already handled …
Engage In Review Feedback Passed The current review produced zero actionable findings, and no CodeRabbit review threads were returned. Therefore, the pull request had no review feedback that required engagement, implementation, or re…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Stovedal
Stovedal force-pushed the fix/preserve-network-error-cause branch from 66448da to 009bf42 Compare October 15, 2026 12:23
@Stovedal Stovedal changed the title fix: Preserve the cause of a thrown network error in RESTController.handleError fix: Preserve the cause of a thrown error in RESTController.handleError Oct 15, 2026
@Stovedal
Stovedal marked this pull request as ready for review October 15, 2026 12:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RESTController.handleError discards error.cause, making network failures hard to diagnose

1 participant