Fix a doc typo.
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Exception / Interface.pm
1 package Catalyst::Exception::Interface;
2
3 use MooseX::Role::WithOverloading;
4 use namespace::clean -except => 'meta';
5
6 use overload
7     q{""}    => sub { $_[0]->as_string },
8     fallback => 1;
9
10 requires qw/as_string throw rethrow/;
11
12 1;
13
14 __END__
15
16 =head1 NAME
17
18 Catalyst::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
33 See also L<Catalyst> and L<Catalyst::Exception>.
34
35 =head1 DESCRIPTION
36
37 This is a role for the required interface for Catalyst exceptions.
38
39 It ensures that all exceptions follow the expected interface,
40 and adds overloading for stringification when composed onto a
41 class.
42
43 Note that if you compose this role onto another role, that role
44 must 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
58 Provided by Moose
59
60 =head1 AUTHORS
61
62 Catalyst Contributors, see Catalyst.pm
63
64 =head1 COPYRIGHT
65
66 This library is free software. You can redistribute it and/or modify
67 it under the same terms as Perl itself.
68
69 =cut