Require Dist::Zilla 4.200016+
[gitmo/Moose.git] / lib / Moose / Error / Confess.pm
1 package Moose::Error::Confess;
2
3 use strict;
4 use warnings;
5
6 use base qw(Moose::Error::Default);
7
8 sub new {
9     my ( $self, @args ) = @_;
10     $self->create_error_confess(@args);
11 }
12
13 sub _inline_new {
14     my ( $self, %args ) = @_;
15
16     my $depth = ($args{depth} || 0) - 1;
17     return 'Moose::Error::Util::create_error_confess('
18       . 'message => ' . $args{message} . ', '
19       . 'depth   => ' . $depth         . ', '
20   . ')';
21 }
22
23 1;
24
25 # ABSTRACT: Prefer C<confess>
26
27 __END__
28
29 =pod
30
31 =head1 SYNOPSIS
32
33     # Metaclass definition must come before Moose is used.
34     use metaclass (
35         metaclass => 'Moose::Meta::Class',
36         error_class => 'Moose::Error::Confess',
37     );
38     use Moose;
39     # ...
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