1 package Moose::Error::Default;
7 my ( $self, @args ) = @_;
8 $self->create_error_confess(@args);
11 sub create_error_croak {
12 my ( $self, @args ) = @_;
13 $self->_create_error_carpmess(@args);
16 sub create_error_confess {
17 my ( $self, @args ) = @_;
18 $self->_create_error_carpmess( @args, longmess => 1 );
21 sub _create_error_carpmess {
22 my ( $self, %args ) = @_;
24 my $carp_level = 3 + ( $args{depth} || 1 );
25 local $Carp::MaxArgNums = 20
26 ; # default is 8, usually we use named args which gets messier though
28 my @args = exists $args{message} ? $args{message} : ();
30 if ( $args{longmess} || $Carp::Verbose ) {
31 local $Carp::CarpLevel = ( $Carp::CarpLevel || 0 ) + $carp_level;
32 return Carp::longmess(@args);
35 return Carp::ret_summary( $carp_level, @args );
47 Moose::Error::Default - L<Carp> based error generation for Moose.
51 This class implements L<Carp> based error generation.
53 The default behavior is like L<Moose::Error::Confess>.
61 Create a new error. Delegates to C<create_error_confess>.
63 =item create_error_confess @args
65 =item create_error_croak @args
67 Creates a new errors string of the specified style.