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