=begin pod

=TITLE class X::AdHoc

    class X::AdHoc is Exception { ... }

C<X::AdHoc> is the type into which objects are wrapped if they are
thrown as exceptions, but don't inherit from L<Exception>.

Its benefit over returning non-C<Exception> objects is that it gives
access to all the methods from class L<Exception>, like C<backtrace>
and C<rethrow>.

You can obtain the original object with the C<payload> method.

    try {
        die [404, 'File not found']; # throw non-exception object
    }
    say "Got HTTP code ",
        $!.payload[0],          # 404
        " and backtrace ",
        $!.backtrace;

=head1 Methods

=head2 payload

    method payload(X::AdHoc:D)

Returns the original object which was passed to C<die>.

=end pod

