1 package Catalyst::Exception::Interface;
4 use namespace::clean -except => 'meta';
7 q{""} => sub { $_[0]->as_string },
10 requires qw/as_string throw rethrow/;
18 Catalyst::Exception::Interface - Role defining the interface for Catalyst exceptions
22 package My::Catalyst::Like::Exception;
24 use namespace::clean -except => 'meta';
26 with 'Catalyst::Exception::Interface';
28 # This comprises the required interface.
29 sub as_string { 'the exception text for stringification' }
30 sub throw { shift; die @_ }
31 sub rethrow { shift; die @_ }
35 This is a role for the required interface for Catalyst exceptions.
37 It ensures that all exceptions follow the expected interface,
38 and adds overloading for stringification when composed onto a
41 =head1 REQUIRED METHODS
61 =item L<Catalyst::Exception>
67 Catalyst Contributors, see Catalyst.pm
71 This library is free software. You can redistribute it and/or modify
72 it under the same terms as Perl itself.