macro_rules! err {
    ($error:tt $(,)?) => { ... };
    ($error:expr $(,)?) => { ... };
}
Expand description

Returns with the given error. Use this with a custom error type.

§Example

// Instruction function
pub fn example(ctx: Context<Example>) -> Result<()> {
    err!(MyError::SomeError)
}

// An enum for custom error codes
#[error_code]
pub enum MyError {
    SomeError
}