Skip to main content

err

Macro err 

Source
macro_rules! err {
    ( $e:expr ) => { ... };
}
Expand description

Return an error immediately. Parallel to Anchor’s err!.

The macro expands to a bare return Err(...), so the call site reads like a control-flow keyword rather than an expression. The argument is evaluated as an expression so either a Hopper-generated error code or a raw ProgramError works.

if amount == 0 {
    return err!(VaultError::ZeroDeposit);
}