1 package Catalyst::Exception::Interface;
3 use MooseX::Role::WithOverloading;
4 use namespace::clean -except => 'meta';
7 q{""} => sub { $_[0]->as_string },
10 requires qw/as_string throw rethrow/;
18 Catalyst::Exception::Interface - Exception for redispatching using $ctx->detach()
22 package My::Catalyst::Like::Exception;
24 use namespace::clean -except => 'meta';
26 # This comprises the required interface.
27 sub as_string { 'the exception text for stringification' }
28 sub die { shift; die @_ }
29 sub die { shift; die @_ }
31 with 'Catalyst::Exception::Interface';
33 See also L<Catalyst> and L<Catalyst::Exception>.
37 This is a role for the required interface for Catalyst exceptions.
39 It ensures that all exceptions follow the expected interface,
40 and adds overloading for stringification when composed onto a
43 Note that if you compose this role onto another role, that role
44 must use L<MooseX::Role::WithOverloading>.
46 =head1 REQUIRED METHODS
62 Catalyst Contributors, see Catalyst.pm
66 This library is free software. You can redistribute it and/or modify
67 it under the same terms as Perl itself.