
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@solana/programs
Advanced tools
This package contains helpers for identifying custom program errors. It can be used standalone, but it is also exported as part of Kit @solana/kit.
isProgramError()This function identifies whether an error -- typically caused by a transaction failure -- is a custom program error from the provided program address. It takes the following parameters:
error to identify.transactionMessage object that failed to execute. Since the RPC response only provides the index of the failed instruction, the transaction message is required to determine its program address.programAddress of the program from which the error is expected to have originated.code of the custom program error. When provided, the function will check that the custom program error code matches the given value.try {
// Send and confirm your transaction.
} catch (error) {
if (isProgramError(error, transactionMessage, myProgramAddress, 42)) {
// Handle custom program error 42 from this program.
} else if (isProgramError(error, transactionMessage, myProgramAddress)) {
// Handle all other custom program errors from this program.
} else {
throw error;
}
}
FAQs
Helpers for defining programs and resolving program errors
The npm package @solana/programs receives a total of 236,088 weekly downloads. As such, @solana/programs popularity was classified as popular.
We found that @solana/programs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.