8000 bugfix: custom error code parser in ProgramError by kAsky53 · Pull Request #3625 · solana-foundation/anchor · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

bugfix: custom error code parser in ProgramError #3625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kAsky53
Copy link
Contributor
@kAsky53 kAsky53 commented Mar 28, 2025

The error code below will not be parsed because there are two "custom program error:"s in the error.

Error: Simulation failed. 
Message: Transaction simulation failed: Error processing Instruction 2: custom program error: 0x1771. 
Logs: 
[
  "Program rev31KMq4qzt1y1iw926p694MHVVWT57caQrsHLFA4x invoke [1]",
  "Program log: Instruction: ClaimMiner",
  "Program data: +12UGC+xiy4Tzbc04ARQ52SqTDPkFbiiSPdTmhY9gKGDcESjPUUr+DN0qXcfFQAATqcADHAhGQAAAAAAAAAAACbimwQAAAAAAAAAAAAAAABLoOVnAAAAAA==",
  "Program data: vWUq6Q3/38vx7gy1EA2D//7/yOn4PjyXar0f5/ze4Wbkwge3aJWdB+w9IZcgAAAAggIagAcAAAAAAAAAAAAAAGm5Sg8AAAAAxLljxWEAAAAAAAAAAAAAAOf4GwAAAAAAAAAAAAAAAAA=",
  "Program data: ZAOvscU2Tx4HGb3wxOZOxu7WWaHc0D3k6X8oIwPRgRPj5oKIu8dMsGcJfgcAAAAAbjwAAAAAAAAAAAAAAAAAALJHAwAAAAAA",
  "Program log: AnchorError thrown in programs/rewarder/src/processor/miner_update.rs:124. Error Code: NoClaimableRewards. Error Number: 6001. Error Message: No rewards are currently available for claiming.",
  "Program log: Left: 0",
  "Program log: Right: 0",
  "Program rev31KMq4qzt1y1iw926p694MHVVWT57caQrsHLFA4x consumed 17925 of 18836 compute units",
  "Program rev31KMq4qzt1y1iw926p694MHVVWT57caQrsHLFA4x failed: custom program error: 0x1771"
]. 
Catch the SendTransactionError and call getLogs() on it for full details.

Copy link
vercel bot commented Mar 28, 2025

@kAsky53 is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

if (components.length !== 2) {
return null;
} else {
if (components.length > 2) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a proper fix, since components[1] doesn't contain just the error code—it includes more content, so trying to parse it as an integer will fail.

Copy link
Contributor Author
@kAsky53 kAsky53 Apr 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fantasyup parseInt() will parse it correctly though.

> parseInt('0x1771 [x.dsfjsfha; 1231]%@5')
6001
> parseInt('0x1771. Logs: [  "Program rev31KMq4qzt1y1iw926p694MHVVWT57caQrsHLFA4x invoke [1]",')
6001

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.

2 participants
0