Skip to content

Commit

Permalink
Document Exception|Cool.Failure coercer
Browse files Browse the repository at this point in the history
  • Loading branch information
lizmat committed Mar 7, 2023
1 parent 1d11030 commit b3e0c1d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doc/Type/Cool.rakudoc
Expand Up @@ -1448,4 +1448,15 @@ had been coerced to is negative.
say (-4/3).UInt.^name; # OUTPUT: «Failure␤»
say "foo".UInt.^name; # OUTPUT: «Failure␤»

=head2 method Failure

method Failure(Exception:D --> Failure:D)

Available as of the 2022.06 release of the Rakudo compiler.

Creates an C<X::AdHoc> exception with the stringification of the
invocant, and coerces that into a L<Failure|/type/Failure> object.
Mainly intended to reduce the bytecode for error branches in code,
to increase the chances of hot code getting inlined.

=end pod
8 changes: 8 additions & 0 deletions doc/Type/Exception.rakudoc
Expand Up @@ -121,6 +121,14 @@ a newline.
# OUTPUT: «This exception is pretty bad
# in block <unit> at <unknown file> line 1␤»

=head2 method Failure

method Failure(Exception:D --> Failure:D)

Available as of the 2022.06 release of the Rakudo compiler.

Coerces the C<Exception> into a L<Failure|/type/Failure> object.

=head2 routine die

multi sub die()
Expand Down

0 comments on commit b3e0c1d

Please sign in to comment.