Commit | Line | Data |
---|---|---|
bf6fa6b3 | 1 | package Moose::Error::Croak; |
2 | ||
c0e91e5f | 3 | use strict; |
4 | use warnings; | |
5 | ||
bf6fa6b3 | 6 | use base qw(Moose::Error::Default); |
7 | ||
8 | sub new { | |
9 | my ( $self, @args ) = @_; | |
10 | $self->create_error_croak(@args); | |
11 | } | |
12 | ||
9c1bf11e | 13 | 1; |
bf6fa6b3 | 14 | |
ad46f524 | 15 | # ABSTRACT: Prefer C<croak> |
16 | ||
bf6fa6b3 | 17 | __END__ |
18 | ||
19 | =pod | |
20 | ||
bf6fa6b3 | 21 | =head1 SYNOPSIS |
22 | ||
af1c30e0 | 23 | # Metaclass definition must come before Moose is used. |
24 | use metaclass ( | |
25 | metaclass => 'Moose::Meta::Class', | |
26 | error_class => 'Moose::Error::Croak', | |
bf6fa6b3 | 27 | ); |
af1c30e0 | 28 | use Moose; |
29 | # ... | |
bf6fa6b3 | 30 | |
31 | =head1 DESCRIPTION | |
32 | ||
33 | This error class uses L<Carp/croak> to raise errors generated in your | |
34 | metaclass. | |
35 | ||
36 | =head1 METHODS | |
37 | ||
38 | =over 4 | |
39 | ||
40 | =item new | |
41 | ||
42 | Overrides L<Moose::Error::Default/new> to prefer C<croak>. | |
43 | ||
44 | =back | |
45 | ||
46 | =cut | |
47 | ||
48 |