Expand description
Klend program error codes.
Anchor custom errors start at offset 6000. Each variant’s error code is 6000 + variant index.
Use LendingError::from_error_code to convert an on-chain error code back to a variant,
or TryFrom<u32> for the same purpose.
§Example
use klend_interface::LendingError;
// Decode an error code from a failed transaction
let error = LendingError::from_error_code(6008);
assert_eq!(error, Some(LendingError::InsufficientLiquidity));
assert_eq!(error.unwrap().error_code(), 6008);
assert_eq!(
error.unwrap().to_string(),
"Insufficient liquidity available"
);