control flow fail

Documentation for control flow fail, assembled from the following types:

language documentation Control Flow

From Control Flow

(Control Flow) control flow fail

Leaves the current routine and returns the provided Exception or Str wrapped inside a Failure, after all relevant phasers are executed. If the caller activated fatal exceptions via the pragma use fatal;, the exception is thrown instead of being returned as a Failure.

sub f { fail "WELP!" };
say f;
CATCH { default { say .^name''.Str } }
# OUTPUT: «X::AdHoc: WELP!␤»