From: Yuval Kogman Date: Thu, 4 Sep 2008 00:51:52 +0000 (+0000) Subject: Merge ../Moose-error into pluggable_errors X-Git-Tag: 0.58~54^2~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=46cb090ff626142f0b7d094b91ce45c15dc98f14;p=gitmo%2FMoose.git Merge ../Moose-error into pluggable_errors --- diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index 7c481c0..b454640 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -544,7 +544,7 @@ sub get_value { return wantarray ? %{ $rv } : $rv; } else { - $self->throw_error("Can not auto de-reference the type constraint '" . $type_constraint->name . "'", object => $instance, data => $type_constraint); + $self->throw_error("Can not auto de-reference the type constraint '" . $type_constraint->name . "'", object => $instance, type_constraint => $type_constraint); } } @@ -773,7 +773,7 @@ I Before setting the value, a check is made on the type constraint of the attribute, if it has one, to see if the value passes it. If the -value fails to pass, the set operation dies with a L. +value fails to pass, the set operation dies with a L. Any coercion to convert values is done before checking the type constraint. diff --git a/lib/Moose/Meta/Method/Accessor.pm b/lib/Moose/Meta/Method/Accessor.pm index 718313e..65835a0 100644 --- a/lib/Moose/Meta/Method/Accessor.pm +++ b/lib/Moose/Meta/Method/Accessor.pm @@ -272,7 +272,7 @@ sub _inline_auto_deref { $sigil = '%'; } else { - $self->throw_error("Can not auto de-reference the type constraint '" . $type_constraint->name . "'", data => $type_constraint ); + $self->throw_error("Can not auto de-reference the type constraint '" . $type_constraint->name . "'", type_constraint => $type_constraint ); } "(wantarray() ? $sigil\{ ( $ref_value ) || return } : ( $ref_value ) )"; diff --git a/lib/Moose/Meta/Method/Augmented.pm b/lib/Moose/Meta/Method/Augmented.pm index c69f8bb..1980053 100644 --- a/lib/Moose/Meta/Method/Augmented.pm +++ b/lib/Moose/Meta/Method/Augmented.pm @@ -3,8 +3,6 @@ package Moose::Meta::Method::Augmented; use strict; use warnings; -use Carp 'confess'; - our $VERSION = '0.57'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; diff --git a/lib/Moose/Meta/Method/Destructor.pm b/lib/Moose/Meta/Method/Destructor.pm index ef5660e..6950680 100644 --- a/lib/Moose/Meta/Method/Destructor.pm +++ b/lib/Moose/Meta/Method/Destructor.pm @@ -4,7 +4,6 @@ package Moose::Meta::Method::Destructor; use strict; use warnings; -use Carp 'confess'; use Scalar::Util 'blessed', 'weaken'; our $VERSION = '0.57'; @@ -18,12 +17,12 @@ sub new { my $class = shift; my %options = @_; - (exists $options{options} && ref $options{options} eq 'HASH') - || confess "You must pass a hash of options"; - + (ref $options{options} eq 'HASH') + || $class->throw_error("You must pass a hash of options", data => $options{options}); + ($options{package_name} && $options{name}) - || confess "You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT"; - + || $class->throw_error("You must supply the package_name and name parameters $Class::MOP::Method::UPGRADE_ERROR_TEXT"); + my $self = bless { # from our superclass 'body' => undef, @@ -57,7 +56,7 @@ sub is_needed { # then must pass in a class name unless (blessed $self) { (blessed $_[0] && $_[0]->isa('Class::MOP::Class')) - || confess "When calling is_needed as a class method you must pass a class name"; + || $self->throw_error("When calling is_needed as a class method you must pass a class name"); return $_[0]->meta->can('DEMOLISH'); } defined $self->{'body'} ? 1 : 0 @@ -92,7 +91,7 @@ sub initialize_body { my $code; { $code = eval $source; - confess "Could not eval the destructor :\n\n$source\n\nbecause :\n\n$@" if $@; + $self->throw_error("Could not eval the destructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source) if $@; } $self->{'body'} = $code; } diff --git a/lib/Moose/Object.pm b/lib/Moose/Object.pm index 242425f..1c6f441 100644 --- a/lib/Moose/Object.pm +++ b/lib/Moose/Object.pm @@ -7,8 +7,6 @@ use warnings; use if ( not our $__mx_is_compiled ), 'Moose::Meta::Class'; use if ( not our $__mx_is_compiled ), metaclass => 'Moose::Meta::Class'; -use Carp 'confess'; - our $VERSION = '0.57'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN';