NAME

Ryu::Exception - support for Future-style failure information

SYNOPSIS

 use Ryu::Exception;
 my $exception = Ryu::Exception->new(
  type    => 'http',
  message => '404 response'
  details => [ $response, $request ]
 );
 Future->fail($exception->failure);

DESCRIPTION

Generic exceptions interface, implements the 3-part failure codes as described in Future.

new

Instantiate from named parameters.

throw

Throws this exception.

 $exception->throw;

type

Returns the type, which should be a string such as http.

message

Returns the message, which is a freeform string.

details

Returns the list of details, the specifics of which are specific to the type.

fail

Fails the given Future with this exception.

as_future

Returns a failed Future containing the message, type and details from this exception.

from_future

Extracts failure information from a Future and instantiates accordingly.

AUTHOR

Tom Molesworth <TEAM@cpan.org>

LICENSE

Copyright Tom Molesworth 2011-2020. Licensed under the same terms as Perl itself.