macro_rules! err { ($error:tt $(,)?) => { ... }; ($error:expr $(,)?) => { ... }; }
Returns with the given error. Use this with a custom error type.
// Instruction function pub fn example(ctx: Context<Example>) -> Result<()> { err!(MyError::SomeError) } // An enum for custom error codes #[error_code] pub enum MyError { SomeError }