Skip to content

fix(xc_admin): rethrow caught error instead of empty Error#3621

Open
dhruvja wants to merge 1 commit intopyth-network:mainfrom
dhruvja:fork/preserve-error-in-crank-scripts
Open

fix(xc_admin): rethrow caught error instead of empty Error#3621
dhruvja wants to merge 1 commit intopyth-network:mainfrom
dhruvja:fork/preserve-error-in-crank-scripts

Conversation

@dhruvja
Copy link
Copy Markdown

@dhruvja dhruvja commented Apr 22, 2026

Summary

The change replaces throw new Error(); with throw err; in the top-level catch of both crank scripts.

Rationale

  • throw new Error() creates a brand-new Error with no message and a stack trace that points at line 63 (or 231) which is at the re-throw itself, not at where the failure actually happened.
  • The original error is discarded. console.error(err) prints it to stderr first, but Node's eventual "uncaught exception" report shows the thrown error which is the empty one.
  • Result in practice: an operator looking at why a crank process died sees a useless empty-message stack ending at throw new Error() instead of the real RPC timeout / auth failure / malformed VAA / whatever triggered it.
  • throw err; preserves the original error message, stack, and any properties like cause. Node reports the real failure in its crash output, so root-causing a production incident is one less instead of a forensic dig.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

@dhruvja is attempting to deploy a commit to the Pyth Network Team on Vercel.

A member of the Team first needs to authorize it.

@vercel vercel Bot temporarily deployed to Preview – api-reference April 22, 2026 07:20 Inactive
@vercel vercel Bot temporarily deployed to Preview – proposals April 22, 2026 07:20 Inactive
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
api-reference Skipped Skipped Apr 22, 2026 7:20am
proposals Skipped Skipped Apr 22, 2026 7:20am

Request Review

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.

1 participant