Rename http server test as it is not optional for authors
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Exception / Interface.pm
CommitLineData
ede5238f 1package Catalyst::Exception::Interface;
2
80e287ba 3use MooseX::Role::WithOverloading;
4use namespace::clean -except => 'meta';
5
6use overload
7 q{""} => sub { $_[0]->as_string },
8 fallback => 1;
ede5238f 9
10requires qw/as_string throw rethrow/;
11
121;
b6c6af73 13
14__END__
15
16=head1 NAME
17
18Catalyst::Exception::Interface - Exception for redispatching using $ctx->detach()
19
20=head1 SYNOPSIS
21
22 package My::Catalyst::Like::Exception;
23 use Moose;
24 use namespace::clean -except => 'meta';
25
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 @_ }
30
31 with 'Catalyst::Exception::Interface';
32
33See also L<Catalyst> and L<Catalyst::Exception>.
34
35=head1 DESCRIPTION
36
37This is a role for the required interface for Catalyst exceptions.
38
39It ensures that all exceptions follow the expected interface,
40and adds overloading for stringification when composed onto a
41class.
42
43Note that if you compose this role onto another role, that role
44must use L<MooseX::Role::WithOverloading>.
45
46=head1 REQUIRED METHODS
47
48=head2 as_string
49
50=head2 throw
51
52=head2 rethrow
53
54=head1 METHODS
55
56=head2 meta
57
58Provided by Moose
59
60=head1 AUTHORS
61
62Catalyst Contributors, see Catalyst.pm
63
64=head1 COPYRIGHT
65
66This library is free software. You can redistribute it and/or modify
67it under the same terms as Perl itself.
68
69=cut