Anchor Error Codes

Dev Tools · Deep

Anchor's error handling system. `#[error_code]` defines an enum of custom errors (auto-numbered from 6000). `require!(condition, ErrorCode)` and `require_keys_eq!()` macros provide concise validation. Errors include the program name and error name in logs. Custom errors return in the transaction metadata and can be parsed by clients via the IDL.

Related terms