diff options
Diffstat (limited to 'lib/Moose/Exception')
228 files changed, 4403 insertions, 0 deletions
diff --git a/lib/Moose/Exception/AccessorMustReadWrite.pm b/lib/Moose/Exception/AccessorMustReadWrite.pm new file mode 100644 index 0000000..d33d928 --- /dev/null +++ b/lib/Moose/Exception/AccessorMustReadWrite.pm @@ -0,0 +1,13 @@ +package Moose::Exception::AccessorMustReadWrite; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "Cannot define an accessor name on a read-only attribute, accessors are read/write"; +} + +1; diff --git a/lib/Moose/Exception/AddParameterizableTypeTakesParameterizableType.pm b/lib/Moose/Exception/AddParameterizableTypeTakesParameterizableType.pm new file mode 100644 index 0000000..8bd52f8 --- /dev/null +++ b/lib/Moose/Exception/AddParameterizableTypeTakesParameterizableType.pm @@ -0,0 +1,18 @@ +package Moose::Exception::AddParameterizableTypeTakesParameterizableType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'type_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Type must be a Moose::Meta::TypeConstraint::Parameterizable not ".$self->type_name; +} + +1; diff --git a/lib/Moose/Exception/AddRoleTakesAMooseMetaRoleInstance.pm b/lib/Moose/Exception/AddRoleTakesAMooseMetaRoleInstance.pm new file mode 100644 index 0000000..b3ca1f3 --- /dev/null +++ b/lib/Moose/Exception/AddRoleTakesAMooseMetaRoleInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::AddRoleTakesAMooseMetaRoleInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'role_to_be_added' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + "Roles must be instances of Moose::Meta::Role"; +} + +1; diff --git a/lib/Moose/Exception/AddRoleToARoleTakesAMooseMetaRole.pm b/lib/Moose/Exception/AddRoleToARoleTakesAMooseMetaRole.pm new file mode 100644 index 0000000..98a72ab --- /dev/null +++ b/lib/Moose/Exception/AddRoleToARoleTakesAMooseMetaRole.pm @@ -0,0 +1,18 @@ +package Moose::Exception::AddRoleToARoleTakesAMooseMetaRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'role_to_be_added' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + "Roles must be instances of Moose::Meta::Role"; +} + +1; diff --git a/lib/Moose/Exception/ApplyTakesABlessedInstance.pm b/lib/Moose/Exception/ApplyTakesABlessedInstance.pm new file mode 100644 index 0000000..fa65f79 --- /dev/null +++ b/lib/Moose/Exception/ApplyTakesABlessedInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::ApplyTakesABlessedInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'param' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + "You must pass in an blessed instance"; +} + +1; diff --git a/lib/Moose/Exception/AttachToClassNeedsAClassMOPClassInstanceOrASubclass.pm b/lib/Moose/Exception/AttachToClassNeedsAClassMOPClassInstanceOrASubclass.pm new file mode 100644 index 0000000..f944577 --- /dev/null +++ b/lib/Moose/Exception/AttachToClassNeedsAClassMOPClassInstanceOrASubclass.pm @@ -0,0 +1,18 @@ +package Moose::Exception::AttachToClassNeedsAClassMOPClassInstanceOrASubclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'class' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "You must pass a Class::MOP::Class instance (or a subclass)"; +} + +1; diff --git a/lib/Moose/Exception/AttributeConflictInRoles.pm b/lib/Moose/Exception/AttributeConflictInRoles.pm new file mode 100644 index 0000000..00d7b56 --- /dev/null +++ b/lib/Moose/Exception/AttributeConflictInRoles.pm @@ -0,0 +1,31 @@ +package Moose::Exception::AttributeConflictInRoles; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'second_role_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $role_name = $self->role_name; + my $second_role_name = $self->second_role_name; + my $attribute_name = $self->attribute_name; + "Role '$role_name' has encountered an attribute conflict" + . " while being composed into '$second_role_name'." + . " This is a fatal error and cannot be disambiguated." + . " The conflicting attribute is named '$attribute_name'."; +} + +1; diff --git a/lib/Moose/Exception/AttributeConflictInSummation.pm b/lib/Moose/Exception/AttributeConflictInSummation.pm new file mode 100644 index 0000000..81ba5b7 --- /dev/null +++ b/lib/Moose/Exception/AttributeConflictInSummation.pm @@ -0,0 +1,27 @@ +package Moose::Exception::AttributeConflictInSummation; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::AttributeName'; + +has 'second_role_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + + my $role1 = $self->role_name; + my $role2 = $self->second_role_name; + my $attr_name = $self->attribute_name; + + return "We have encountered an attribute conflict with '$attr_name'" + . " during role composition. " + . " This attribute is defined in both $role1 and $role2." + . " This is a fatal error and cannot be disambiguated."; +} + +1; diff --git a/lib/Moose/Exception/AttributeExtensionIsNotSupportedInRoles.pm b/lib/Moose/Exception/AttributeExtensionIsNotSupportedInRoles.pm new file mode 100644 index 0000000..8face5c --- /dev/null +++ b/lib/Moose/Exception/AttributeExtensionIsNotSupportedInRoles.pm @@ -0,0 +1,18 @@ +package Moose::Exception::AttributeExtensionIsNotSupportedInRoles; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + "has '+attr' is not supported in roles"; +} + +1; diff --git a/lib/Moose/Exception/AttributeIsRequired.pm b/lib/Moose/Exception/AttributeIsRequired.pm new file mode 100644 index 0000000..fa852dd --- /dev/null +++ b/lib/Moose/Exception/AttributeIsRequired.pm @@ -0,0 +1,28 @@ +package Moose::Exception::AttributeIsRequired; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1, + documentation => "This attribute can be used for fetching attribute instance:\n". + " my \$class = Moose::Util::find_meta( \$exception->class_name );\n". + " my \$attribute = \$class->get_attribute( \$exception->attribute_name );\n", +); + +has 'params' => ( + is => 'ro', + isa => 'HashRef', + predicate => 'has_params', +); + +sub _build_message { + my $self = shift; + "Attribute (".$self->attribute_name.") is required"; +} + +1; diff --git a/lib/Moose/Exception/AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass.pm b/lib/Moose/Exception/AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass.pm new file mode 100644 index 0000000..8f89d97 --- /dev/null +++ b/lib/Moose/Exception/AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass.pm @@ -0,0 +1,18 @@ +package Moose::Exception::AttributeMustBeAnClassMOPMixinAttributeCoreOrSubclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'attribute' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "Your attribute must be an instance of Class::MOP::Mixin::AttributeCore (or a subclass)"; +} + +1; diff --git a/lib/Moose/Exception/AttributeNamesDoNotMatch.pm b/lib/Moose/Exception/AttributeNamesDoNotMatch.pm new file mode 100644 index 0000000..4510eed --- /dev/null +++ b/lib/Moose/Exception/AttributeNamesDoNotMatch.pm @@ -0,0 +1,24 @@ +package Moose::Exception::AttributeNamesDoNotMatch; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has attribute_name => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +has attribute => ( + is => 'ro', + isa => 'Class::MOP::Attribute', + required => 1, +); + +sub _build_message { + my $self = shift; + "attribute_name (".$self-> attribute_name.") does not match attribute->name (".$self->attribute->name.")"; +} + +1; diff --git a/lib/Moose/Exception/AttributeValueIsNotAnObject.pm b/lib/Moose/Exception/AttributeValueIsNotAnObject.pm new file mode 100644 index 0000000..523a4a9 --- /dev/null +++ b/lib/Moose/Exception/AttributeValueIsNotAnObject.pm @@ -0,0 +1,27 @@ +package Moose::Exception::AttributeValueIsNotAnObject; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::Attribute'; + +has 'method' => ( + is => 'ro', + isa => 'Moose::Meta::Method::Delegation', + required => 1, +); + +has 'given_value' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + my $self = shift; + "Cannot delegate ".$self->method->name." to " + .$self->method->delegate_to_method." because the value of " + . $self->attribute->name . " is not an object (got '".$self->given_value."')"; +} + +1; diff --git a/lib/Moose/Exception/AttributeValueIsNotDefined.pm b/lib/Moose/Exception/AttributeValueIsNotDefined.pm new file mode 100644 index 0000000..95555a6 --- /dev/null +++ b/lib/Moose/Exception/AttributeValueIsNotDefined.pm @@ -0,0 +1,21 @@ +package Moose::Exception::AttributeValueIsNotDefined; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::Attribute'; + +has 'method' => ( + is => 'ro', + isa => 'Moose::Meta::Method::Delegation', + required => 1, +); + +sub _build_message { + my $self = shift; + "Cannot delegate ".$self->method->name." to " + .$self->method->delegate_to_method." because the value of " + . $self->attribute->name . " is not defined"; +} + +1; diff --git a/lib/Moose/Exception/AutoDeRefNeedsArrayRefOrHashRef.pm b/lib/Moose/Exception/AutoDeRefNeedsArrayRefOrHashRef.pm new file mode 100644 index 0000000..ef32986 --- /dev/null +++ b/lib/Moose/Exception/AutoDeRefNeedsArrayRefOrHashRef.pm @@ -0,0 +1,13 @@ +package Moose::Exception::AutoDeRefNeedsArrayRefOrHashRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/BadOptionFormat.pm b/lib/Moose/Exception/BadOptionFormat.pm new file mode 100644 index 0000000..cccee33 --- /dev/null +++ b/lib/Moose/Exception/BadOptionFormat.pm @@ -0,0 +1,24 @@ +package Moose::Exception::BadOptionFormat; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'option_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'option_value' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "bad accessor/reader/writer/predicate/clearer format, must be a HASH ref"; +} + +1; diff --git a/lib/Moose/Exception/BothBuilderAndDefaultAreNotAllowed.pm b/lib/Moose/Exception/BothBuilderAndDefaultAreNotAllowed.pm new file mode 100644 index 0000000..022268d --- /dev/null +++ b/lib/Moose/Exception/BothBuilderAndDefaultAreNotAllowed.pm @@ -0,0 +1,18 @@ +package Moose::Exception::BothBuilderAndDefaultAreNotAllowed; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "Setting both default and builder is not allowed."; +} + +1; diff --git a/lib/Moose/Exception/BuilderDoesNotExist.pm b/lib/Moose/Exception/BuilderDoesNotExist.pm new file mode 100644 index 0000000..6629352 --- /dev/null +++ b/lib/Moose/Exception/BuilderDoesNotExist.pm @@ -0,0 +1,13 @@ +package Moose::Exception::BuilderDoesNotExist; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Instance'; + +sub _build_message { + my $self = shift; + blessed($self->instance)." does not support builder method '".$self->attribute->builder."' for attribute '".$self->attribute->name."'"; +} + +1; diff --git a/lib/Moose/Exception/BuilderMethodNotSupportedForAttribute.pm b/lib/Moose/Exception/BuilderMethodNotSupportedForAttribute.pm new file mode 100644 index 0000000..648d50c --- /dev/null +++ b/lib/Moose/Exception/BuilderMethodNotSupportedForAttribute.pm @@ -0,0 +1,13 @@ +package Moose::Exception::BuilderMethodNotSupportedForAttribute; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Instance'; + +sub _build_message { + my $self = shift; + blessed($self->instance)." does not support builder method '". $self->attribute->builder ."' for attribute '" . $self->attribute->name . "'"; +} + +1; diff --git a/lib/Moose/Exception/BuilderMethodNotSupportedForInlineAttribute.pm b/lib/Moose/Exception/BuilderMethodNotSupportedForInlineAttribute.pm new file mode 100644 index 0000000..9757e65 --- /dev/null +++ b/lib/Moose/Exception/BuilderMethodNotSupportedForInlineAttribute.pm @@ -0,0 +1,25 @@ +package Moose::Exception::BuilderMethodNotSupportedForInlineAttribute; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::Class'; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'builder' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + $self->class_name." does not support builder method '". $self->builder ."' for attribute '" . $self->attribute_name . "'"; +} + +1; diff --git a/lib/Moose/Exception/BuilderMustBeAMethodName.pm b/lib/Moose/Exception/BuilderMustBeAMethodName.pm new file mode 100644 index 0000000..967ba5f --- /dev/null +++ b/lib/Moose/Exception/BuilderMustBeAMethodName.pm @@ -0,0 +1,18 @@ +package Moose::Exception::BuilderMustBeAMethodName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "builder must be a defined scalar value which is a method name"; +} + +1; diff --git a/lib/Moose/Exception/CallingMethodOnAnImmutableInstance.pm b/lib/Moose/Exception/CallingMethodOnAnImmutableInstance.pm new file mode 100644 index 0000000..6ac2d37 --- /dev/null +++ b/lib/Moose/Exception/CallingMethodOnAnImmutableInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::CallingMethodOnAnImmutableInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "The '".$self->method_name."' method cannot be called on an immutable instance"; +} + +1; diff --git a/lib/Moose/Exception/CallingReadOnlyMethodOnAnImmutableInstance.pm b/lib/Moose/Exception/CallingReadOnlyMethodOnAnImmutableInstance.pm new file mode 100644 index 0000000..e880935 --- /dev/null +++ b/lib/Moose/Exception/CallingReadOnlyMethodOnAnImmutableInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::CallingReadOnlyMethodOnAnImmutableInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "The '".$self->method_name."' method is read-only when called on an immutable instance"; +} + +1; diff --git a/lib/Moose/Exception/CanExtendOnlyClasses.pm b/lib/Moose/Exception/CanExtendOnlyClasses.pm new file mode 100644 index 0000000..9519aed --- /dev/null +++ b/lib/Moose/Exception/CanExtendOnlyClasses.pm @@ -0,0 +1,14 @@ +package Moose::Exception::CanExtendOnlyClasses; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +sub _build_message { + my $self = shift; + my $role_name = $self->role_name; + return "You cannot inherit from a Moose Role ($role_name)"; +} + +1; diff --git a/lib/Moose/Exception/CanOnlyConsumeRole.pm b/lib/Moose/Exception/CanOnlyConsumeRole.pm new file mode 100644 index 0000000..3cc7288 --- /dev/null +++ b/lib/Moose/Exception/CanOnlyConsumeRole.pm @@ -0,0 +1,17 @@ +package Moose::Exception::CanOnlyConsumeRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'role_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + "You can only consume roles, ".$self->role_name." is not a Moose role"; +} +1; diff --git a/lib/Moose/Exception/CanOnlyWrapBlessedCode.pm b/lib/Moose/Exception/CanOnlyWrapBlessedCode.pm new file mode 100644 index 0000000..997b39e --- /dev/null +++ b/lib/Moose/Exception/CanOnlyWrapBlessedCode.pm @@ -0,0 +1,24 @@ +package Moose::Exception::CanOnlyWrapBlessedCode; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'code' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "Can only wrap blessed CODE"; +} + +1; diff --git a/lib/Moose/Exception/CanReblessOnlyIntoASubclass.pm b/lib/Moose/Exception/CanReblessOnlyIntoASubclass.pm new file mode 100644 index 0000000..fbc216c --- /dev/null +++ b/lib/Moose/Exception/CanReblessOnlyIntoASubclass.pm @@ -0,0 +1,14 @@ +package Moose::Exception::CanReblessOnlyIntoASubclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::InstanceClass'; + +sub _build_message { + my $self = shift; + my $instance_class = $self->instance_class; + "You may rebless only into a subclass of ($instance_class), of which (". $self->class_name .") isn't." +} + +1; diff --git a/lib/Moose/Exception/CanReblessOnlyIntoASuperclass.pm b/lib/Moose/Exception/CanReblessOnlyIntoASuperclass.pm new file mode 100644 index 0000000..b164381 --- /dev/null +++ b/lib/Moose/Exception/CanReblessOnlyIntoASuperclass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CanReblessOnlyIntoASuperclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::InstanceClass'; + +sub _build_message { + my $self = shift; + "You may rebless only into a superclass of (".blessed( $self->instance )."), of which (". $self->class_name .") isn't." +} + +1; diff --git a/lib/Moose/Exception/CannotAddAdditionalTypeCoercionsToUnion.pm b/lib/Moose/Exception/CannotAddAdditionalTypeCoercionsToUnion.pm new file mode 100644 index 0000000..7edba0f --- /dev/null +++ b/lib/Moose/Exception/CannotAddAdditionalTypeCoercionsToUnion.pm @@ -0,0 +1,17 @@ +package Moose::Exception::CannotAddAdditionalTypeCoercionsToUnion; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'type_coercion_union_object' => ( + is => 'ro', + isa => 'Moose::Meta::TypeCoercion::Union', + required => 1 +); + +sub _build_message { + return "Cannot add additional type coercions to Union types"; +} + +1; diff --git a/lib/Moose/Exception/CannotAddAsAnAttributeToARole.pm b/lib/Moose/Exception/CannotAddAsAnAttributeToARole.pm new file mode 100644 index 0000000..960d56c --- /dev/null +++ b/lib/Moose/Exception/CannotAddAsAnAttributeToARole.pm @@ -0,0 +1,19 @@ +package Moose::Exception::CannotAddAsAnAttributeToARole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'attribute_class' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + "Cannot add a ".$self->attribute_class." as an attribute to a role"; +} + +1; diff --git a/lib/Moose/Exception/CannotApplyBaseClassRolesToRole.pm b/lib/Moose/Exception/CannotApplyBaseClassRolesToRole.pm new file mode 100644 index 0000000..d38630a --- /dev/null +++ b/lib/Moose/Exception/CannotApplyBaseClassRolesToRole.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CannotApplyBaseClassRolesToRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Role'; + +sub _build_message { + "You can only apply base class roles to a Moose class, not a role."; +} + +1; diff --git a/lib/Moose/Exception/CannotAssignValueToReadOnlyAccessor.pm b/lib/Moose/Exception/CannotAssignValueToReadOnlyAccessor.pm new file mode 100644 index 0000000..37195a8 --- /dev/null +++ b/lib/Moose/Exception/CannotAssignValueToReadOnlyAccessor.pm @@ -0,0 +1,19 @@ +package Moose::Exception::CannotAssignValueToReadOnlyAccessor; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::EitherAttributeOrAttributeName'; + +has 'value' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + "Cannot assign a value to a read-only accessor"; +} + +1; diff --git a/lib/Moose/Exception/CannotAugmentIfLocalMethodPresent.pm b/lib/Moose/Exception/CannotAugmentIfLocalMethodPresent.pm new file mode 100644 index 0000000..6a3339e --- /dev/null +++ b/lib/Moose/Exception/CannotAugmentIfLocalMethodPresent.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CannotAugmentIfLocalMethodPresent; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Method'; + +sub _build_message { + "Cannot add an augment method if a local method is already present"; +} + +1; diff --git a/lib/Moose/Exception/CannotAugmentNoSuperMethod.pm b/lib/Moose/Exception/CannotAugmentNoSuperMethod.pm new file mode 100644 index 0000000..5f36249 --- /dev/null +++ b/lib/Moose/Exception/CannotAugmentNoSuperMethod.pm @@ -0,0 +1,25 @@ +package Moose::Exception::CannotAugmentNoSuperMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "You cannot augment '".$self->method_name."' because it has no super method"; +} + +1; diff --git a/lib/Moose/Exception/CannotAutoDerefWithoutIsa.pm b/lib/Moose/Exception/CannotAutoDerefWithoutIsa.pm new file mode 100644 index 0000000..f0952bf --- /dev/null +++ b/lib/Moose/Exception/CannotAutoDerefWithoutIsa.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotAutoDerefWithoutIsa; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "You cannot auto-dereference without specifying a type constraint on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/CannotAutoDereferenceTypeConstraint.pm b/lib/Moose/Exception/CannotAutoDereferenceTypeConstraint.pm new file mode 100644 index 0000000..3266ce4 --- /dev/null +++ b/lib/Moose/Exception/CannotAutoDereferenceTypeConstraint.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotAutoDereferenceTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Instance', 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + "Can not auto de-reference the type constraint '" . $self->type_name . "'"; +} + +1; diff --git a/lib/Moose/Exception/CannotCalculateNativeType.pm b/lib/Moose/Exception/CannotCalculateNativeType.pm new file mode 100644 index 0000000..2593cb4 --- /dev/null +++ b/lib/Moose/Exception/CannotCalculateNativeType.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotCalculateNativeType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +sub _build_message { + my $self = shift; + "Cannot calculate native type for " . ref $self->instance; +} + +1; diff --git a/lib/Moose/Exception/CannotCallAnAbstractBaseMethod.pm b/lib/Moose/Exception/CannotCallAnAbstractBaseMethod.pm new file mode 100644 index 0000000..3204c4e --- /dev/null +++ b/lib/Moose/Exception/CannotCallAnAbstractBaseMethod.pm @@ -0,0 +1,18 @@ +package Moose::Exception::CannotCallAnAbstractBaseMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'package_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + $self->package_name. " is an abstract base class, you must provide a constructor."; +} + +1; diff --git a/lib/Moose/Exception/CannotCallAnAbstractMethod.pm b/lib/Moose/Exception/CannotCallAnAbstractMethod.pm new file mode 100644 index 0000000..1d076ad --- /dev/null +++ b/lib/Moose/Exception/CannotCallAnAbstractMethod.pm @@ -0,0 +1,11 @@ +package Moose::Exception::CannotCallAnAbstractMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "Abstract method"; +} + +1; diff --git a/lib/Moose/Exception/CannotCoerceAWeakRef.pm b/lib/Moose/Exception/CannotCoerceAWeakRef.pm new file mode 100644 index 0000000..bb4a18b --- /dev/null +++ b/lib/Moose/Exception/CannotCoerceAWeakRef.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotCoerceAWeakRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "You cannot have a weak reference to a coerced value on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/CannotCoerceAttributeWhichHasNoCoercion.pm b/lib/Moose/Exception/CannotCoerceAttributeWhichHasNoCoercion.pm new file mode 100644 index 0000000..aabec96 --- /dev/null +++ b/lib/Moose/Exception/CannotCoerceAttributeWhichHasNoCoercion.pm @@ -0,0 +1,16 @@ +package Moose::Exception::CannotCoerceAttributeWhichHasNoCoercion; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions', 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + my $name = $self->attribute_name; + my $type = $self->type_name; + + return "You cannot coerce an attribute ($name) unless its type ($type) has a coercion"; +} + +1; diff --git a/lib/Moose/Exception/CannotCreateHigherOrderTypeWithoutATypeParameter.pm b/lib/Moose/Exception/CannotCreateHigherOrderTypeWithoutATypeParameter.pm new file mode 100644 index 0000000..fc7257b --- /dev/null +++ b/lib/Moose/Exception/CannotCreateHigherOrderTypeWithoutATypeParameter.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CannotCreateHigherOrderTypeWithoutATypeParameter; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + "You cannot create a Higher Order type without a type parameter"; +} + +1; diff --git a/lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresent.pm b/lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresent.pm new file mode 100644 index 0000000..fd3c85d --- /dev/null +++ b/lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresent.pm @@ -0,0 +1,24 @@ +package Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresent; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::Method'; + +has 'role_being_applied_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'aliased_method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "Cannot create a method alias if a local method of the same name exists"; +} + +1; diff --git a/lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresentInClass.pm b/lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresentInClass.pm new file mode 100644 index 0000000..df3d191 --- /dev/null +++ b/lib/Moose/Exception/CannotCreateMethodAliasLocalMethodIsPresentInClass.pm @@ -0,0 +1,18 @@ +package Moose::Exception::CannotCreateMethodAliasLocalMethodIsPresentInClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::Method', 'Moose::Exception::Role::Class'; + +has 'aliased_method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "Cannot create a method alias if a local method of the same name exists"; +} + +1; diff --git a/lib/Moose/Exception/CannotDelegateLocalMethodIsPresent.pm b/lib/Moose/Exception/CannotDelegateLocalMethodIsPresent.pm new file mode 100644 index 0000000..6232437 --- /dev/null +++ b/lib/Moose/Exception/CannotDelegateLocalMethodIsPresent.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotDelegateLocalMethodIsPresent; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute', 'Moose::Exception::Role::Method'; + +sub _build_message { + my $self = shift; + "You cannot overwrite a locally defined method (".$self->method->name.") with a delegation"; +} + +1; diff --git a/lib/Moose/Exception/CannotDelegateWithoutIsa.pm b/lib/Moose/Exception/CannotDelegateWithoutIsa.pm new file mode 100644 index 0000000..e7ac308 --- /dev/null +++ b/lib/Moose/Exception/CannotDelegateWithoutIsa.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CannotDelegateWithoutIsa; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +sub _build_message { + "Cannot delegate methods based on a Regexp without a type constraint (isa)"; +} + +1; diff --git a/lib/Moose/Exception/CannotFindDelegateMetaclass.pm b/lib/Moose/Exception/CannotFindDelegateMetaclass.pm new file mode 100644 index 0000000..5cbb744 --- /dev/null +++ b/lib/Moose/Exception/CannotFindDelegateMetaclass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotFindDelegateMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +sub _build_message { + my $self = shift; + "Cannot find delegate metaclass for attribute ".$self->attribute->name; +} + +1; diff --git a/lib/Moose/Exception/CannotFindType.pm b/lib/Moose/Exception/CannotFindType.pm new file mode 100644 index 0000000..d9a3d89 --- /dev/null +++ b/lib/Moose/Exception/CannotFindType.pm @@ -0,0 +1,18 @@ +package Moose::Exception::CannotFindType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'type_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Cannot find type '".$self->type_name."', perhaps you forgot to load it"; +} + +1; diff --git a/lib/Moose/Exception/CannotFindTypeGivenToMatchOnType.pm b/lib/Moose/Exception/CannotFindTypeGivenToMatchOnType.pm new file mode 100644 index 0000000..147231f --- /dev/null +++ b/lib/Moose/Exception/CannotFindTypeGivenToMatchOnType.pm @@ -0,0 +1,32 @@ +package Moose::Exception::CannotFindTypeGivenToMatchOnType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'to_match' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'action' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'type' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + my $type = $self->type; + + return "Cannot find or parse the type '$type'" +} + +1; diff --git a/lib/Moose/Exception/CannotFixMetaclassCompatibility.pm b/lib/Moose/Exception/CannotFixMetaclassCompatibility.pm new file mode 100644 index 0000000..8367213 --- /dev/null +++ b/lib/Moose/Exception/CannotFixMetaclassCompatibility.pm @@ -0,0 +1,25 @@ +package Moose::Exception::CannotFixMetaclassCompatibility; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'superclass' => ( + is => 'ro', + isa => 'Object', + required => 1 +); + +has 'metaclass_type' => ( + is => 'ro', + isa => 'Str', +); + +sub _build_message { + my $self = shift; + my $class_name = $self->class_name; + "Can't fix metaclass incompatibility for $class_name because it is not pristine."; +} + +1; diff --git a/lib/Moose/Exception/CannotGenerateInlineConstraint.pm b/lib/Moose/Exception/CannotGenerateInlineConstraint.pm new file mode 100644 index 0000000..55e5a1e --- /dev/null +++ b/lib/Moose/Exception/CannotGenerateInlineConstraint.pm @@ -0,0 +1,29 @@ +package Moose::Exception::CannotGenerateInlineConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +has 'parameterizable_type_object_name' => ( + is => 'ro', + isa => 'Str', + required => 1, + documentation => "This attribute can be used for fetching parameterizable type constraint(Moose::Meta::TypeConstraint::Parameterizable):\n". + " my \$type_constraint = Moose::Util::TypeConstraints::find_type_constraint( \$exception->type_name );\n", +); + +has 'value' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $type = $self->type_name; + + return "Can't generate an inline constraint for $type, since none was defined"; +} + +1; diff --git a/lib/Moose/Exception/CannotInitializeMooseMetaRoleComposite.pm b/lib/Moose/Exception/CannotInitializeMooseMetaRoleComposite.pm new file mode 100644 index 0000000..e1a0a4e --- /dev/null +++ b/lib/Moose/Exception/CannotInitializeMooseMetaRoleComposite.pm @@ -0,0 +1,29 @@ +package Moose::Exception::CannotInitializeMooseMetaRoleComposite; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'role_composite' => ( + is => 'ro', + isa => 'Moose::Meta::Role::Composite', + required => 1 +); + +has 'old_meta' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'args' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + 'Moose::Meta::Role::Composite instances can only be reinitialized from an existing metaclass instance'; +} + +1; diff --git a/lib/Moose/Exception/CannotInlineTypeConstraintCheck.pm b/lib/Moose/Exception/CannotInlineTypeConstraintCheck.pm new file mode 100644 index 0000000..2a99985 --- /dev/null +++ b/lib/Moose/Exception/CannotInlineTypeConstraintCheck.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotInlineTypeConstraintCheck; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + 'Cannot inline a type constraint check for ' . $self->type_name; +} + +1; diff --git a/lib/Moose/Exception/CannotLocatePackageInINC.pm b/lib/Moose/Exception/CannotLocatePackageInINC.pm new file mode 100644 index 0000000..b910c16 --- /dev/null +++ b/lib/Moose/Exception/CannotLocatePackageInINC.pm @@ -0,0 +1,40 @@ +package Moose::Exception::CannotLocatePackageInINC; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'INC' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +has 'possible_packages' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'metaclass_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'type' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + my $possible_packages = $self->possible_packages; + my @inc = @{$self->INC}; + + return "Can't locate $possible_packages in \@INC (\@INC contains: @INC)." +} + +1; diff --git a/lib/Moose/Exception/CannotMakeMetaclassCompatible.pm b/lib/Moose/Exception/CannotMakeMetaclassCompatible.pm new file mode 100644 index 0000000..c313888 --- /dev/null +++ b/lib/Moose/Exception/CannotMakeMetaclassCompatible.pm @@ -0,0 +1,22 @@ +package Moose::Exception::CannotMakeMetaclassCompatible; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'superclass_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $class_name = $self->class_name; + my $superclass = $self->superclass_name; + + return "Can't make $class_name compatible with metaclass $superclass"; +} + +1; diff --git a/lib/Moose/Exception/CannotOverrideALocalMethod.pm b/lib/Moose/Exception/CannotOverrideALocalMethod.pm new file mode 100644 index 0000000..0730185 --- /dev/null +++ b/lib/Moose/Exception/CannotOverrideALocalMethod.pm @@ -0,0 +1,19 @@ +package Moose::Exception::CannotOverrideALocalMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + "Cannot add an override of method '".$self->method_name."' because there is a local version of '".$self->method_name."'"; +} + +1; diff --git a/lib/Moose/Exception/CannotOverrideBodyOfMetaMethods.pm b/lib/Moose/Exception/CannotOverrideBodyOfMetaMethods.pm new file mode 100644 index 0000000..763779a --- /dev/null +++ b/lib/Moose/Exception/CannotOverrideBodyOfMetaMethods.pm @@ -0,0 +1,18 @@ +package Moose::Exception::CannotOverrideBodyOfMetaMethods; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "Overriding the body of meta methods is not allowed"; +} + +1; diff --git a/lib/Moose/Exception/CannotOverrideLocalMethodIsPresent.pm b/lib/Moose/Exception/CannotOverrideLocalMethodIsPresent.pm new file mode 100644 index 0000000..42815c2 --- /dev/null +++ b/lib/Moose/Exception/CannotOverrideLocalMethodIsPresent.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CannotOverrideLocalMethodIsPresent; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Method'; + +sub _build_message { + "Cannot add an override method if a local method is already present"; +} + +1; diff --git a/lib/Moose/Exception/CannotOverrideNoSuperMethod.pm b/lib/Moose/Exception/CannotOverrideNoSuperMethod.pm new file mode 100644 index 0000000..21fd873 --- /dev/null +++ b/lib/Moose/Exception/CannotOverrideNoSuperMethod.pm @@ -0,0 +1,25 @@ +package Moose::Exception::CannotOverrideNoSuperMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "You cannot override '".$self->method_name."' because it has no super method"; +} + +1; diff --git a/lib/Moose/Exception/CannotRegisterUnnamedTypeConstraint.pm b/lib/Moose/Exception/CannotRegisterUnnamedTypeConstraint.pm new file mode 100644 index 0000000..0182b1d --- /dev/null +++ b/lib/Moose/Exception/CannotRegisterUnnamedTypeConstraint.pm @@ -0,0 +1,11 @@ +package Moose::Exception::CannotRegisterUnnamedTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "can't register an unnamed type constraint"; +} + +1; diff --git a/lib/Moose/Exception/CannotUseLazyBuildAndDefaultSimultaneously.pm b/lib/Moose/Exception/CannotUseLazyBuildAndDefaultSimultaneously.pm new file mode 100644 index 0000000..36a2021 --- /dev/null +++ b/lib/Moose/Exception/CannotUseLazyBuildAndDefaultSimultaneously.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CannotUseLazyBuildAndDefaultSimultaneously; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "You can not use lazy_build and default for the same attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/CircularReferenceInAlso.pm b/lib/Moose/Exception/CircularReferenceInAlso.pm new file mode 100644 index 0000000..7306adf --- /dev/null +++ b/lib/Moose/Exception/CircularReferenceInAlso.pm @@ -0,0 +1,30 @@ +package Moose::Exception::CircularReferenceInAlso; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'also_parameter' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'stack' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + my $self = shift; + my $also_member = $self->also_parameter; + + my @stack = @{$self->stack}; + my $existing_stack = join( ', ', @stack); + + return "Circular reference in 'also' parameter to Moose::Exporter between " + ."$existing_stack and $also_member"; +} + +1; diff --git a/lib/Moose/Exception/ClassDoesNotHaveInitMeta.pm b/lib/Moose/Exception/ClassDoesNotHaveInitMeta.pm new file mode 100644 index 0000000..a4c06bb --- /dev/null +++ b/lib/Moose/Exception/ClassDoesNotHaveInitMeta.pm @@ -0,0 +1,21 @@ +package Moose::Exception::ClassDoesNotHaveInitMeta; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'traits' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + my $self = shift; + my $class = $self->class_name; + + return "Cannot provide traits when $class does not have an init_meta() method"; +} + +1; diff --git a/lib/Moose/Exception/ClassDoesTheExcludedRole.pm b/lib/Moose/Exception/ClassDoesTheExcludedRole.pm new file mode 100644 index 0000000..b53337f --- /dev/null +++ b/lib/Moose/Exception/ClassDoesTheExcludedRole.pm @@ -0,0 +1,21 @@ +package Moose::Exception::ClassDoesTheExcludedRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role', 'Moose::Exception::Role::Class'; + +has 'excluded_role_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $excluded_role_name = $self->excluded_role_name; + my $class_name = $self->class_name; + return "The class $class_name does the excluded role '$excluded_role_name'"; +} + +1; diff --git a/lib/Moose/Exception/ClassNamesDoNotMatch.pm b/lib/Moose/Exception/ClassNamesDoNotMatch.pm new file mode 100644 index 0000000..aca9dd8 --- /dev/null +++ b/lib/Moose/Exception/ClassNamesDoNotMatch.pm @@ -0,0 +1,24 @@ +package Moose::Exception::ClassNamesDoNotMatch; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has class_name => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +has class => ( + is => 'ro', + isa => 'Class::MOP::Class', + required => 1, +); + +sub _build_message { + my $self = shift; + "class_name (".$self-> class_name.") does not match class->name (".$self->class->name.")"; +} + +1; diff --git a/lib/Moose/Exception/CloneObjectExpectsAnInstanceOfMetaclass.pm b/lib/Moose/Exception/CloneObjectExpectsAnInstanceOfMetaclass.pm new file mode 100644 index 0000000..7ac0c8b --- /dev/null +++ b/lib/Moose/Exception/CloneObjectExpectsAnInstanceOfMetaclass.pm @@ -0,0 +1,19 @@ +package Moose::Exception::CloneObjectExpectsAnInstanceOfMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'instance' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + my $self = shift; + "You must pass an instance of the metaclass (" .$self->class_name. "), not (".$self->instance.")"; +} + +1; diff --git a/lib/Moose/Exception/CodeBlockMustBeACodeRef.pm b/lib/Moose/Exception/CodeBlockMustBeACodeRef.pm new file mode 100644 index 0000000..5b50a79 --- /dev/null +++ b/lib/Moose/Exception/CodeBlockMustBeACodeRef.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CodeBlockMustBeACodeRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Instance'; + +sub _build_message { + "Your code block must be a CODE reference"; +} + +1; diff --git a/lib/Moose/Exception/CoercingWithoutCoercions.pm b/lib/Moose/Exception/CoercingWithoutCoercions.pm new file mode 100644 index 0000000..b2e3438 --- /dev/null +++ b/lib/Moose/Exception/CoercingWithoutCoercions.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CoercingWithoutCoercions; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + "Cannot coerce without a type coercion"; +} +1; diff --git a/lib/Moose/Exception/CoercionAlreadyExists.pm b/lib/Moose/Exception/CoercionAlreadyExists.pm new file mode 100644 index 0000000..53342d8 --- /dev/null +++ b/lib/Moose/Exception/CoercionAlreadyExists.pm @@ -0,0 +1,19 @@ +package Moose::Exception::CoercionAlreadyExists; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +has 'constraint_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "A coercion action already exists for '".$self->constraint_name."'"; +} + +1; diff --git a/lib/Moose/Exception/CoercionNeedsTypeConstraint.pm b/lib/Moose/Exception/CoercionNeedsTypeConstraint.pm new file mode 100644 index 0000000..b385be9 --- /dev/null +++ b/lib/Moose/Exception/CoercionNeedsTypeConstraint.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CoercionNeedsTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "You cannot have coercion without specifying a type constraint on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/ConflictDetectedInCheckRoleExclusions.pm b/lib/Moose/Exception/ConflictDetectedInCheckRoleExclusions.pm new file mode 100644 index 0000000..06f7de9 --- /dev/null +++ b/lib/Moose/Exception/ConflictDetectedInCheckRoleExclusions.pm @@ -0,0 +1,21 @@ +package Moose::Exception::ConflictDetectedInCheckRoleExclusions; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'excluded_role_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $role_name = $self->role_name; + my $excluded_role_name = $self->excluded_role_name; + return "Conflict detected: $role_name excludes role '$excluded_role_name'"; +} + +1; diff --git a/lib/Moose/Exception/ConflictDetectedInCheckRoleExclusionsInToClass.pm b/lib/Moose/Exception/ConflictDetectedInCheckRoleExclusionsInToClass.pm new file mode 100644 index 0000000..89b9baf --- /dev/null +++ b/lib/Moose/Exception/ConflictDetectedInCheckRoleExclusionsInToClass.pm @@ -0,0 +1,15 @@ +package Moose::Exception::ConflictDetectedInCheckRoleExclusionsInToClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Role'; + +sub _build_message { + my $self = shift; + my $class_name = $self->class_name; + my $role_name = $self->role_name; + return "Conflict detected: $class_name excludes role '$role_name'"; +} + +1; diff --git a/lib/Moose/Exception/ConstructClassInstanceTakesPackageName.pm b/lib/Moose/Exception/ConstructClassInstanceTakesPackageName.pm new file mode 100644 index 0000000..3e0954a --- /dev/null +++ b/lib/Moose/Exception/ConstructClassInstanceTakesPackageName.pm @@ -0,0 +1,11 @@ +package Moose::Exception::ConstructClassInstanceTakesPackageName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "You must pass a package name"; +} + +1; diff --git a/lib/Moose/Exception/CouldNotCreateMethod.pm b/lib/Moose/Exception/CouldNotCreateMethod.pm new file mode 100644 index 0000000..e9497b7 --- /dev/null +++ b/lib/Moose/Exception/CouldNotCreateMethod.pm @@ -0,0 +1,31 @@ +package Moose::Exception::CouldNotCreateMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'option_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'option_value' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'error' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Could not create the '".$self->option_name."' method for " . $self->attribute->name . " because : ".$self->error; +} + +1; diff --git a/lib/Moose/Exception/CouldNotCreateWriter.pm b/lib/Moose/Exception/CouldNotCreateWriter.pm new file mode 100644 index 0000000..8bcb7fb --- /dev/null +++ b/lib/Moose/Exception/CouldNotCreateWriter.pm @@ -0,0 +1,23 @@ +package Moose::Exception::CouldNotCreateWriter; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::EitherAttributeOrAttributeName', 'Moose::Exception::Role::Instance'; + +has 'error' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $error = $self->error; + my $attribute_name = $self->attribute_name; + + return "Could not create writer for '$attribute_name' " + . "because $error"; +} + +1; diff --git a/lib/Moose/Exception/CouldNotEvalConstructor.pm b/lib/Moose/Exception/CouldNotEvalConstructor.pm new file mode 100644 index 0000000..95f5738 --- /dev/null +++ b/lib/Moose/Exception/CouldNotEvalConstructor.pm @@ -0,0 +1,33 @@ +package Moose::Exception::CouldNotEvalConstructor; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'constructor_method' => ( + is => 'ro', + isa => 'Class::MOP::Method::Constructor', + required => 1 +); + +has 'source' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'error' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $error = $self->error; + my $source = $self->source; + + return "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$error"; +} + +1; diff --git a/lib/Moose/Exception/CouldNotEvalDestructor.pm b/lib/Moose/Exception/CouldNotEvalDestructor.pm new file mode 100644 index 0000000..40ad749 --- /dev/null +++ b/lib/Moose/Exception/CouldNotEvalDestructor.pm @@ -0,0 +1,33 @@ +package Moose::Exception::CouldNotEvalDestructor; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'method_destructor_object' => ( + is => 'ro', + isa => 'Moose::Meta::Method::Destructor', + required => 1 +); + +has 'source' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'error' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $error = $self->error; + my $source = $self->source; + + return "Could not eval the destructor :\n\n$source\n\nbecause :\n\n$error"; +} + +1; diff --git a/lib/Moose/Exception/CouldNotFindTypeConstraintToCoerceFrom.pm b/lib/Moose/Exception/CouldNotFindTypeConstraintToCoerceFrom.pm new file mode 100644 index 0000000..1e364b7 --- /dev/null +++ b/lib/Moose/Exception/CouldNotFindTypeConstraintToCoerceFrom.pm @@ -0,0 +1,19 @@ +package Moose::Exception::CouldNotFindTypeConstraintToCoerceFrom; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +has 'constraint_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Could not find the type constraint (".$self->constraint_name.") to coerce from"; +} + +1; diff --git a/lib/Moose/Exception/CouldNotGenerateInlineAttributeMethod.pm b/lib/Moose/Exception/CouldNotGenerateInlineAttributeMethod.pm new file mode 100644 index 0000000..08ecc44 --- /dev/null +++ b/lib/Moose/Exception/CouldNotGenerateInlineAttributeMethod.pm @@ -0,0 +1,25 @@ +package Moose::Exception::CouldNotGenerateInlineAttributeMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +has 'option' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'error' => ( + is => 'ro', + isa => 'Str|Moose::Exception', + required => 1 +); + +sub _build_message { + my $self = shift; + "Could not generate inline ".$self->option." because : ".$self->error; +} + +1; diff --git a/lib/Moose/Exception/CouldNotLocateTypeConstraintForUnion.pm b/lib/Moose/Exception/CouldNotLocateTypeConstraintForUnion.pm new file mode 100644 index 0000000..7a52456 --- /dev/null +++ b/lib/Moose/Exception/CouldNotLocateTypeConstraintForUnion.pm @@ -0,0 +1,13 @@ +package Moose::Exception::CouldNotLocateTypeConstraintForUnion; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + "Could not locate type constraint (".$self->type_name.") for the union"; +} + +1; diff --git a/lib/Moose/Exception/CouldNotParseType.pm b/lib/Moose/Exception/CouldNotParseType.pm new file mode 100644 index 0000000..a87ecbc --- /dev/null +++ b/lib/Moose/Exception/CouldNotParseType.pm @@ -0,0 +1,29 @@ +package Moose::Exception::CouldNotParseType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'type' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'position' => ( + is => 'ro', + isa => 'Int', + required => 1 +); + +sub _build_message { + my $self = shift; + my $type = $self->type; + my $length = length($type); + my $position = $self->position; + + return "'$type' didn't parse (parse-pos=$position" + . " and str-length=$length)"; +} + +1; diff --git a/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfAttributes.pm b/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfAttributes.pm new file mode 100644 index 0000000..d266888 --- /dev/null +++ b/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfAttributes.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CreateMOPClassTakesArrayRefOfAttributes; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::RoleForCreateMOPClass'; + +sub _build_message { + "You must pass an ARRAY ref of attributes"; +} + +1; diff --git a/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm b/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm new file mode 100644 index 0000000..8a9f49a --- /dev/null +++ b/lib/Moose/Exception/CreateMOPClassTakesArrayRefOfSuperclasses.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CreateMOPClassTakesArrayRefOfSuperclasses; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::RoleForCreateMOPClass'; + +sub _build_message { + "You must pass an ARRAY ref of superclasses"; +} + +1; diff --git a/lib/Moose/Exception/CreateMOPClassTakesHashRefOfMethods.pm b/lib/Moose/Exception/CreateMOPClassTakesHashRefOfMethods.pm new file mode 100644 index 0000000..9c17f4d --- /dev/null +++ b/lib/Moose/Exception/CreateMOPClassTakesHashRefOfMethods.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CreateMOPClassTakesHashRefOfMethods; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::RoleForCreateMOPClass'; + +sub _build_message { + "You must pass an HASH ref of methods"; +} + +1; diff --git a/lib/Moose/Exception/CreateTakesArrayRefOfRoles.pm b/lib/Moose/Exception/CreateTakesArrayRefOfRoles.pm new file mode 100644 index 0000000..bd92403 --- /dev/null +++ b/lib/Moose/Exception/CreateTakesArrayRefOfRoles.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CreateTakesArrayRefOfRoles; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::RoleForCreate'; + +sub _build_message { + "You must pass an ARRAY ref of roles"; +} + +1; diff --git a/lib/Moose/Exception/CreateTakesHashRefOfAttributes.pm b/lib/Moose/Exception/CreateTakesHashRefOfAttributes.pm new file mode 100644 index 0000000..d0b451c --- /dev/null +++ b/lib/Moose/Exception/CreateTakesHashRefOfAttributes.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CreateTakesHashRefOfAttributes; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::RoleForCreate'; + +sub _build_message { + "You must pass a HASH ref of attributes"; +} + +1; diff --git a/lib/Moose/Exception/CreateTakesHashRefOfMethods.pm b/lib/Moose/Exception/CreateTakesHashRefOfMethods.pm new file mode 100644 index 0000000..6ef9000 --- /dev/null +++ b/lib/Moose/Exception/CreateTakesHashRefOfMethods.pm @@ -0,0 +1,12 @@ +package Moose::Exception::CreateTakesHashRefOfMethods; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::RoleForCreate'; + +sub _build_message { + "You must pass a HASH ref of methods"; +} + +1; diff --git a/lib/Moose/Exception/DefaultToMatchOnTypeMustBeCodeRef.pm b/lib/Moose/Exception/DefaultToMatchOnTypeMustBeCodeRef.pm new file mode 100644 index 0000000..74925ce --- /dev/null +++ b/lib/Moose/Exception/DefaultToMatchOnTypeMustBeCodeRef.pm @@ -0,0 +1,32 @@ +package Moose::Exception::DefaultToMatchOnTypeMustBeCodeRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'to_match' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'default_action' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'cases_to_be_matched' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + my $self = shift; + my $default = $self->default_action; + + return "Default case must be a CODE ref, not $default"; +} + +1; diff --git a/lib/Moose/Exception/DelegationToAClassWhichIsNotLoaded.pm b/lib/Moose/Exception/DelegationToAClassWhichIsNotLoaded.pm new file mode 100644 index 0000000..6e96c80 --- /dev/null +++ b/lib/Moose/Exception/DelegationToAClassWhichIsNotLoaded.pm @@ -0,0 +1,19 @@ +package Moose::Exception::DelegationToAClassWhichIsNotLoaded; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'class_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + "The ".$self->attribute->name." attribute is trying to delegate to a class which has not been loaded - ".$self->class_name; +} + +1; diff --git a/lib/Moose/Exception/DelegationToARoleWhichIsNotLoaded.pm b/lib/Moose/Exception/DelegationToARoleWhichIsNotLoaded.pm new file mode 100644 index 0000000..96a04ac --- /dev/null +++ b/lib/Moose/Exception/DelegationToARoleWhichIsNotLoaded.pm @@ -0,0 +1,19 @@ +package Moose::Exception::DelegationToARoleWhichIsNotLoaded; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'role_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + "The ".$self->attribute->name." attribute is trying to delegate to a role which has not been loaded - ".$self->role_name; +} + +1; diff --git a/lib/Moose/Exception/DelegationToATypeWhichIsNotAClass.pm b/lib/Moose/Exception/DelegationToATypeWhichIsNotAClass.pm new file mode 100644 index 0000000..055c685 --- /dev/null +++ b/lib/Moose/Exception/DelegationToATypeWhichIsNotAClass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::DelegationToATypeWhichIsNotAClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +sub _build_message { + my $self = shift; + "The ".$self->attribute->name." attribute is trying to delegate to a type (".$self->attribute->type_constraint->name.") that is not backed by a class"; +} + +1; diff --git a/lib/Moose/Exception/DoesRequiresRoleName.pm b/lib/Moose/Exception/DoesRequiresRoleName.pm new file mode 100644 index 0000000..f3437ca --- /dev/null +++ b/lib/Moose/Exception/DoesRequiresRoleName.pm @@ -0,0 +1,12 @@ +package Moose::Exception::DoesRequiresRoleName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + "You must supply a role name to does()"; +} + +1; diff --git a/lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm b/lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm new file mode 100644 index 0000000..19fac8a --- /dev/null +++ b/lib/Moose/Exception/EnumCalledWithAnArrayRefAndAdditionalArgs.pm @@ -0,0 +1,23 @@ +package Moose::Exception::EnumCalledWithAnArrayRefAndAdditionalArgs; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'array' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +has 'args' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + "enum called with an array reference and additional arguments. Did you mean to parenthesize the enum call's parameters?"; +} + +1; diff --git a/lib/Moose/Exception/EnumValuesMustBeString.pm b/lib/Moose/Exception/EnumValuesMustBeString.pm new file mode 100644 index 0000000..6694e27 --- /dev/null +++ b/lib/Moose/Exception/EnumValuesMustBeString.pm @@ -0,0 +1,25 @@ +package Moose::Exception::EnumValuesMustBeString; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'value' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + "Enum values must be strings, not ".( defined $self->value ? "'".$self->value."'" : "undef" ); +} + +1; diff --git a/lib/Moose/Exception/ExtendsMissingArgs.pm b/lib/Moose/Exception/ExtendsMissingArgs.pm new file mode 100644 index 0000000..7c34923 --- /dev/null +++ b/lib/Moose/Exception/ExtendsMissingArgs.pm @@ -0,0 +1,12 @@ +package Moose::Exception::ExtendsMissingArgs; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + "Must derive at least one class"; +} + +1; diff --git a/lib/Moose/Exception/HandlesMustBeAHashRef.pm b/lib/Moose/Exception/HandlesMustBeAHashRef.pm new file mode 100644 index 0000000..9eb11a5 --- /dev/null +++ b/lib/Moose/Exception/HandlesMustBeAHashRef.pm @@ -0,0 +1,19 @@ +package Moose::Exception::HandlesMustBeAHashRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +has 'given_handles' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + "The 'handles' option must be a HASH reference, not ".$self->given_handles; +} + +1; diff --git a/lib/Moose/Exception/IllegalInheritedOptions.pm b/lib/Moose/Exception/IllegalInheritedOptions.pm new file mode 100644 index 0000000..2eae454 --- /dev/null +++ b/lib/Moose/Exception/IllegalInheritedOptions.pm @@ -0,0 +1,22 @@ +package Moose::Exception::IllegalInheritedOptions; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'illegal_options' => ( + is => 'ro', + traits => ['Array'], + handles => { + _join_options => 'join', + }, + required => 1, +); + +sub _build_message { + my $self = shift; + "Illegal inherited options => (".$self->_join_options(', ').")"; +} + +1; diff --git a/lib/Moose/Exception/IllegalMethodTypeToAddMethodModifier.pm b/lib/Moose/Exception/IllegalMethodTypeToAddMethodModifier.pm new file mode 100644 index 0000000..458a08b --- /dev/null +++ b/lib/Moose/Exception/IllegalMethodTypeToAddMethodModifier.pm @@ -0,0 +1,30 @@ +package Moose::Exception::IllegalMethodTypeToAddMethodModifier; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'class_or_object' => ( + is => 'ro', + isa => "Any", + required => 1, +); + +has 'params' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1, +); + +has 'modifier_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Methods passed to ".$self->modifier_name." must be provided as a list, arrayref or regex, not ".$self->params->[0]; +} + +1; diff --git a/lib/Moose/Exception/IncompatibleMetaclassOfSuperclass.pm b/lib/Moose/Exception/IncompatibleMetaclassOfSuperclass.pm new file mode 100644 index 0000000..98c8fb2 --- /dev/null +++ b/lib/Moose/Exception/IncompatibleMetaclassOfSuperclass.pm @@ -0,0 +1,26 @@ +package Moose::Exception::IncompatibleMetaclassOfSuperclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has [qw/superclass_name superclass_meta_type class_meta_type/] => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + my $class_name = $self->class_name; + my $class_meta_type = $self->class_meta_type; + my $superclass_name = $self->superclass_name; + my $supermeta_type = $self->superclass_meta_type; + + return "The metaclass of $class_name ($class_meta_type)" . + " is not compatible with the metaclass of its superclass, " . + "$superclass_name ($supermeta_type)"; +} + +1; diff --git a/lib/Moose/Exception/InitMetaRequiresClass.pm b/lib/Moose/Exception/InitMetaRequiresClass.pm new file mode 100644 index 0000000..ca2fb06 --- /dev/null +++ b/lib/Moose/Exception/InitMetaRequiresClass.pm @@ -0,0 +1,12 @@ +package Moose::Exception::InitMetaRequiresClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +sub _build_message { + "Cannot call init_meta without specifying a for_class"; +} + +1; diff --git a/lib/Moose/Exception/InitializeTakesUnBlessedPackageName.pm b/lib/Moose/Exception/InitializeTakesUnBlessedPackageName.pm new file mode 100644 index 0000000..26f782f --- /dev/null +++ b/lib/Moose/Exception/InitializeTakesUnBlessedPackageName.pm @@ -0,0 +1,17 @@ +package Moose::Exception::InitializeTakesUnBlessedPackageName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'package_name' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + "You must pass a package name and it cannot be blessed"; +} + +1; diff --git a/lib/Moose/Exception/InstanceBlessedIntoWrongClass.pm b/lib/Moose/Exception/InstanceBlessedIntoWrongClass.pm new file mode 100644 index 0000000..4d4faff --- /dev/null +++ b/lib/Moose/Exception/InstanceBlessedIntoWrongClass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::InstanceBlessedIntoWrongClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Instance'; + +sub _build_message { + my $self = shift; + "Objects passed as the __INSTANCE__ parameter must already be blessed into the correct class, but ".$self->instance." is not a " . $self->class_name; +} + +1; diff --git a/lib/Moose/Exception/InstanceMustBeABlessedReference.pm b/lib/Moose/Exception/InstanceMustBeABlessedReference.pm new file mode 100644 index 0000000..40b359d --- /dev/null +++ b/lib/Moose/Exception/InstanceMustBeABlessedReference.pm @@ -0,0 +1,19 @@ +package Moose::Exception::InstanceMustBeABlessedReference; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class'; + +has 'instance' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + "The __INSTANCE__ parameter must be a blessed reference, not ". $self->instance; +} + +1; diff --git a/lib/Moose/Exception/InvalidArgPassedToMooseUtilMetaRole.pm b/lib/Moose/Exception/InvalidArgPassedToMooseUtilMetaRole.pm new file mode 100644 index 0000000..2910e7a --- /dev/null +++ b/lib/Moose/Exception/InvalidArgPassedToMooseUtilMetaRole.pm @@ -0,0 +1,40 @@ +package Moose::Exception::InvalidArgPassedToMooseUtilMetaRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'argument' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + my $error = 'When using Moose::Util::MetaRole, you must pass a Moose class name,' + . ' role name, metaclass object, or metarole object.'; + + my $arg = $self->argument; + my $found = blessed $arg ? $arg : Class::MOP::class_of($arg); + + my $error2; + + if ( defined $found && blessed $found ) { + $error2 = " You passed ".$arg.", and we resolved this to a " + . ( blessed $found ) + . ' object.'; + } + elsif ( !defined $found ) { + $error2 = " You passed ".( defined $arg ? $arg : "undef" ).", and this did not resolve to a metaclass or metarole." + . ' Maybe you need to call Moose->init_meta to initialize the metaclass first?'; + } + else { + $error2 = " You passed an undef." + . ' Maybe you need to call Moose->init_meta to initialize the metaclass first?'; + } + + $error.$error2; +} + +1; diff --git a/lib/Moose/Exception/InvalidArgumentToMethod.pm b/lib/Moose/Exception/InvalidArgumentToMethod.pm new file mode 100644 index 0000000..df22ce7 --- /dev/null +++ b/lib/Moose/Exception/InvalidArgumentToMethod.pm @@ -0,0 +1,44 @@ +package Moose::Exception::InvalidArgumentToMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'argument' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has [qw(type type_of_argument method_name)] => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'ordinal' => ( + is => 'ro', + isa => 'Str', + predicate => 'is_ordinal_set' +); + +has 'argument_noun' => ( + is => 'ro', + isa => 'Str', + default => 'argument' +); + +sub _build_message { + my $self = shift; + my $article = ( $self->type_of_argument =~ /^[aeiou]/ ? 'an ' : 'a '); + my $arg_noun = $self->argument_noun; + + if( $self->is_ordinal_set ) { + "The ".$self->ordinal." $arg_noun passed to ".$self->method_name." must be ".$article.$self->type_of_argument; + } + else { + "The $arg_noun passed to ".$self->method_name." must be ".$article.$self->type_of_argument; + } +} + +1; diff --git a/lib/Moose/Exception/InvalidArgumentsToTraitAliases.pm b/lib/Moose/Exception/InvalidArgumentsToTraitAliases.pm new file mode 100644 index 0000000..c60af60 --- /dev/null +++ b/lib/Moose/Exception/InvalidArgumentsToTraitAliases.pm @@ -0,0 +1,31 @@ +package Moose::Exception::InvalidArgumentsToTraitAliases; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +use Scalar::Util qw(reftype); + +has 'alias' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'package_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $alias = $self->alias; + my $reftype_alias = reftype($alias); + + return "$reftype_alias references are not " + . "valid arguments to the 'trait_aliases' option"; +} + +1; diff --git a/lib/Moose/Exception/InvalidBaseTypeGivenToCreateParameterizedTypeConstraint.pm b/lib/Moose/Exception/InvalidBaseTypeGivenToCreateParameterizedTypeConstraint.pm new file mode 100644 index 0000000..48a29c9 --- /dev/null +++ b/lib/Moose/Exception/InvalidBaseTypeGivenToCreateParameterizedTypeConstraint.pm @@ -0,0 +1,13 @@ +package Moose::Exception::InvalidBaseTypeGivenToCreateParameterizedTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + "Could not locate the base type (".$self->type_name.")"; +} + +1; diff --git a/lib/Moose/Exception/InvalidHandleValue.pm b/lib/Moose/Exception/InvalidHandleValue.pm new file mode 100644 index 0000000..04b7c8f --- /dev/null +++ b/lib/Moose/Exception/InvalidHandleValue.pm @@ -0,0 +1,19 @@ +package Moose::Exception::InvalidHandleValue; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +has 'handle_value' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + "All values passed to handles must be strings or ARRAY references, not ".$self->handle_value; +} + +1; diff --git a/lib/Moose/Exception/InvalidHasProvidedInARole.pm b/lib/Moose/Exception/InvalidHasProvidedInARole.pm new file mode 100644 index 0000000..d933d72 --- /dev/null +++ b/lib/Moose/Exception/InvalidHasProvidedInARole.pm @@ -0,0 +1,18 @@ +package Moose::Exception::InvalidHasProvidedInARole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + "Usage: has 'name' => ( key => value, ... )"; +} + +1; diff --git a/lib/Moose/Exception/InvalidNameForType.pm b/lib/Moose/Exception/InvalidNameForType.pm new file mode 100644 index 0000000..500eff2 --- /dev/null +++ b/lib/Moose/Exception/InvalidNameForType.pm @@ -0,0 +1,17 @@ +package Moose::Exception::InvalidNameForType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + $self->name." contains invalid characters for a type name. Names can contain alphanumeric character, ':', and '.'"; +} +1; diff --git a/lib/Moose/Exception/InvalidOverloadOperator.pm b/lib/Moose/Exception/InvalidOverloadOperator.pm new file mode 100644 index 0000000..2a04f12 --- /dev/null +++ b/lib/Moose/Exception/InvalidOverloadOperator.pm @@ -0,0 +1,20 @@ +package Moose::Exception::InvalidOverloadOperator; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has operator => ( + is => 'ro', + isa => 'Defined', + required => 1, +); + +sub _build_message { + my $self = shift; + 'The operator parameter you passed to the Moose::Meta::Overload constructor (' + . $self->operator() + . ') was not a valid overloading operator'; +} + +1; diff --git a/lib/Moose/Exception/InvalidRoleApplication.pm b/lib/Moose/Exception/InvalidRoleApplication.pm new file mode 100644 index 0000000..361cd61 --- /dev/null +++ b/lib/Moose/Exception/InvalidRoleApplication.pm @@ -0,0 +1,18 @@ +package Moose::Exception::InvalidRoleApplication; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'application' => ( + is => 'ro', + isa => "Any", + required => 1, +); + +sub _build_message { + "Role applications must be instances of Moose::Meta::Role::Application::ToClass"; +} + +1; diff --git a/lib/Moose/Exception/InvalidTypeConstraint.pm b/lib/Moose/Exception/InvalidTypeConstraint.pm new file mode 100644 index 0000000..4979400 --- /dev/null +++ b/lib/Moose/Exception/InvalidTypeConstraint.pm @@ -0,0 +1,23 @@ +package Moose::Exception::InvalidTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'registry_object' => ( + is => 'ro', + isa => 'Moose::Meta::TypeConstraint::Registry', + required => 1 +); + +has 'type' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + return "No type supplied / type is not a valid type constraint"; +} + +1; diff --git a/lib/Moose/Exception/InvalidTypeGivenToCreateParameterizedTypeConstraint.pm b/lib/Moose/Exception/InvalidTypeGivenToCreateParameterizedTypeConstraint.pm new file mode 100644 index 0000000..296e4ea --- /dev/null +++ b/lib/Moose/Exception/InvalidTypeGivenToCreateParameterizedTypeConstraint.pm @@ -0,0 +1,13 @@ +package Moose::Exception::InvalidTypeGivenToCreateParameterizedTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + "Could not parse type name (".$self->type_name.") correctly"; +} + +1; diff --git a/lib/Moose/Exception/InvalidValueForIs.pm b/lib/Moose/Exception/InvalidValueForIs.pm new file mode 100644 index 0000000..a81e8fc --- /dev/null +++ b/lib/Moose/Exception/InvalidValueForIs.pm @@ -0,0 +1,13 @@ +package Moose::Exception::InvalidValueForIs; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "I do not understand this option (is => ".$self->params->{is}.") on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/IsaDoesNotDoTheRole.pm b/lib/Moose/Exception/IsaDoesNotDoTheRole.pm new file mode 100644 index 0000000..3abc897 --- /dev/null +++ b/lib/Moose/Exception/IsaDoesNotDoTheRole.pm @@ -0,0 +1,13 @@ +package Moose::Exception::IsaDoesNotDoTheRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "Cannot have an isa option and a does option if the isa does not do the does on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/IsaLacksDoesMethod.pm b/lib/Moose/Exception/IsaLacksDoesMethod.pm new file mode 100644 index 0000000..1ba2a85 --- /dev/null +++ b/lib/Moose/Exception/IsaLacksDoesMethod.pm @@ -0,0 +1,13 @@ +package Moose::Exception::IsaLacksDoesMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "Cannot have an isa option which cannot ->does() on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/LazyAttributeNeedsADefault.pm b/lib/Moose/Exception/LazyAttributeNeedsADefault.pm new file mode 100644 index 0000000..0ba36fa --- /dev/null +++ b/lib/Moose/Exception/LazyAttributeNeedsADefault.pm @@ -0,0 +1,13 @@ +package Moose::Exception::LazyAttributeNeedsADefault; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::EitherAttributeOrAttributeName'; + +sub _build_message { + my $self = shift; + "You cannot have a lazy attribute (".$self->attribute_name.") without specifying a default value for it"; +} + +1; diff --git a/lib/Moose/Exception/Legacy.pm b/lib/Moose/Exception/Legacy.pm new file mode 100644 index 0000000..d960f18 --- /dev/null +++ b/lib/Moose/Exception/Legacy.pm @@ -0,0 +1,7 @@ +package Moose::Exception::Legacy; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +1; diff --git a/lib/Moose/Exception/MOPAttributeNewNeedsAttributeName.pm b/lib/Moose/Exception/MOPAttributeNewNeedsAttributeName.pm new file mode 100644 index 0000000..3b62a92 --- /dev/null +++ b/lib/Moose/Exception/MOPAttributeNewNeedsAttributeName.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MOPAttributeNewNeedsAttributeName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must provide a name for the attribute"; +} + +1; diff --git a/lib/Moose/Exception/MatchActionMustBeACodeRef.pm b/lib/Moose/Exception/MatchActionMustBeACodeRef.pm new file mode 100644 index 0000000..c0c7fb8 --- /dev/null +++ b/lib/Moose/Exception/MatchActionMustBeACodeRef.pm @@ -0,0 +1,27 @@ +package Moose::Exception::MatchActionMustBeACodeRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +has 'to_match' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +has 'action' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + my $action = $self->action; + + return "Match action must be a CODE ref, not $action"; +} + +1; diff --git a/lib/Moose/Exception/MessageParameterMustBeCodeRef.pm b/lib/Moose/Exception/MessageParameterMustBeCodeRef.pm new file mode 100644 index 0000000..c15f689 --- /dev/null +++ b/lib/Moose/Exception/MessageParameterMustBeCodeRef.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MessageParameterMustBeCodeRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "The 'message' parameter must be a coderef"; +} + +1; diff --git a/lib/Moose/Exception/MetaclassIsAClassNotASubclassOfGivenMetaclass.pm b/lib/Moose/Exception/MetaclassIsAClassNotASubclassOfGivenMetaclass.pm new file mode 100644 index 0000000..bbc90be --- /dev/null +++ b/lib/Moose/Exception/MetaclassIsAClassNotASubclassOfGivenMetaclass.pm @@ -0,0 +1,23 @@ +package Moose::Exception::MetaclassIsAClassNotASubclassOfGivenMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +use Moose::Util 'find_meta'; + +has 'metaclass' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $class = find_meta( $self->class_name ); + $self->class_name." already has a metaclass, but it does not inherit ".$self->metaclass. + " ($class). You cannot make the same thing a role and a class. Remove either Moose or Moose::Role."; +} + +1; diff --git a/lib/Moose/Exception/MetaclassIsARoleNotASubclassOfGivenMetaclass.pm b/lib/Moose/Exception/MetaclassIsARoleNotASubclassOfGivenMetaclass.pm new file mode 100644 index 0000000..b6dec64 --- /dev/null +++ b/lib/Moose/Exception/MetaclassIsARoleNotASubclassOfGivenMetaclass.pm @@ -0,0 +1,25 @@ +package Moose::Exception::MetaclassIsARoleNotASubclassOfGivenMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +use Moose::Util 'find_meta'; + +has 'metaclass' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $role_name = $self->role_name; + my $role = find_meta( $role_name ); + my $metaclass = $self->metaclass; + return "$role_name already has a metaclass, but it does not inherit $metaclass ($role). " + ."You cannot make the same thing a role and a class. Remove either Moose or Moose::Role."; +} + +1; diff --git a/lib/Moose/Exception/MetaclassIsNotASubclassOfGivenMetaclass.pm b/lib/Moose/Exception/MetaclassIsNotASubclassOfGivenMetaclass.pm new file mode 100644 index 0000000..53f939b --- /dev/null +++ b/lib/Moose/Exception/MetaclassIsNotASubclassOfGivenMetaclass.pm @@ -0,0 +1,22 @@ +package Moose::Exception::MetaclassIsNotASubclassOfGivenMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +use Moose::Util 'find_meta'; + +has 'metaclass' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $class = find_meta( $self->class_name ); + $self->class_name." already has a metaclass, but it does not inherit ".$self->metaclass." ($class)."; +} + +1; diff --git a/lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaClass.pm b/lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaClass.pm new file mode 100644 index 0000000..6b22e2d --- /dev/null +++ b/lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaClass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::MetaclassMustBeASubclassOfMooseMetaClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + my $self = shift; + "The Metaclass ".$self->class_name." must be a subclass of Moose::Meta::Class." +} + +1; diff --git a/lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaRole.pm b/lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaRole.pm new file mode 100644 index 0000000..e638259 --- /dev/null +++ b/lib/Moose/Exception/MetaclassMustBeASubclassOfMooseMetaRole.pm @@ -0,0 +1,13 @@ +package Moose::Exception::MetaclassMustBeASubclassOfMooseMetaRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +sub _build_message { + my $self = shift; + "The Metaclass ".$self->role_name." must be a subclass of Moose::Meta::Role." +} + +1; diff --git a/lib/Moose/Exception/MetaclassMustBeDerivedFromClassMOPClass.pm b/lib/Moose/Exception/MetaclassMustBeDerivedFromClassMOPClass.pm new file mode 100644 index 0000000..f4d01f5 --- /dev/null +++ b/lib/Moose/Exception/MetaclassMustBeDerivedFromClassMOPClass.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MetaclassMustBeDerivedFromClassMOPClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'class_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "The metaclass (".$self->class_name.") must be derived from Class::MOP::Class"; +} + +1; diff --git a/lib/Moose/Exception/MetaclassNotLoaded.pm b/lib/Moose/Exception/MetaclassNotLoaded.pm new file mode 100644 index 0000000..35238a9 --- /dev/null +++ b/lib/Moose/Exception/MetaclassNotLoaded.pm @@ -0,0 +1,13 @@ +package Moose::Exception::MetaclassNotLoaded; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + my $self = shift; + "The Metaclass ".$self->class_name." must be loaded. (Perhaps you forgot to 'use ".$self->class_name."'?)"; +} + +1; diff --git a/lib/Moose/Exception/MetaclassTypeIncompatible.pm b/lib/Moose/Exception/MetaclassTypeIncompatible.pm new file mode 100644 index 0000000..c56b5c3 --- /dev/null +++ b/lib/Moose/Exception/MetaclassTypeIncompatible.pm @@ -0,0 +1,38 @@ +package Moose::Exception::MetaclassTypeIncompatible; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +use Moose::Util 'find_meta'; + +has [qw(superclass_name metaclass_type)] => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $class_name = $self->class_name; + my $superclass_name = $self->superclass_name; + my $metaclass_type = $self->metaclass_type; + + my $metaclass_type_name = $metaclass_type; + $metaclass_type_name =~ s/_(?:meta)?class$//; + $metaclass_type_name =~ s/_/ /g; + + my $class = find_meta( $class_name ); + + my $self_metaclass_type = $class->$metaclass_type; + + my $super_meta = Class::MOP::get_metaclass_by_name($superclass_name); + my $super_metatype = $super_meta->$metaclass_type; + + return "The $metaclass_type metaclass for $class_name" + . " ($self_metaclass_type) is not compatible with the $metaclass_type_name" + . " metaclass of its superclass, $superclass_name ($super_metatype)"; +} + +1; diff --git a/lib/Moose/Exception/MethodExpectedAMetaclassObject.pm b/lib/Moose/Exception/MethodExpectedAMetaclassObject.pm new file mode 100644 index 0000000..7994cfc --- /dev/null +++ b/lib/Moose/Exception/MethodExpectedAMetaclassObject.pm @@ -0,0 +1,23 @@ +package Moose::Exception::MethodExpectedAMetaclassObject; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'metaclass' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "The is_needed method expected a metaclass object as its arugment"; +} + +1; diff --git a/lib/Moose/Exception/MethodExpectsFewerArgs.pm b/lib/Moose/Exception/MethodExpectsFewerArgs.pm new file mode 100644 index 0000000..e591a67 --- /dev/null +++ b/lib/Moose/Exception/MethodExpectsFewerArgs.pm @@ -0,0 +1,26 @@ +package Moose::Exception::MethodExpectsFewerArgs; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +has 'maximum_args' => ( + is => 'ro', + isa => 'Int', + required => 1, +); + +sub _build_message { + my $self = shift; + my $max = $self->maximum_args; + "Cannot call ".$self->method_name." with ". + ( $max ? "more than $max" : 'any'). " argument".( $max == 1 ? '' : 's' ); +} + +1; diff --git a/lib/Moose/Exception/MethodExpectsMoreArgs.pm b/lib/Moose/Exception/MethodExpectsMoreArgs.pm new file mode 100644 index 0000000..d0e82cf --- /dev/null +++ b/lib/Moose/Exception/MethodExpectsMoreArgs.pm @@ -0,0 +1,24 @@ +package Moose::Exception::MethodExpectsMoreArgs; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'minimum_args' => ( + is => 'ro', + isa => 'Int', + required => 1 +); + +sub _build_message { + my $self = shift; + "Cannot call ".$self->method_name." without at least ".$self->minimum_args." argument".($self->minimum_args == 1 ? '' : 's'); +} + +1; diff --git a/lib/Moose/Exception/MethodModifierNeedsMethodName.pm b/lib/Moose/Exception/MethodModifierNeedsMethodName.pm new file mode 100644 index 0000000..c940608 --- /dev/null +++ b/lib/Moose/Exception/MethodModifierNeedsMethodName.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MethodModifierNeedsMethodName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + "You must pass in a method name"; +} + +1; diff --git a/lib/Moose/Exception/MethodNameConflictInRoles.pm b/lib/Moose/Exception/MethodNameConflictInRoles.pm new file mode 100644 index 0000000..d6db656 --- /dev/null +++ b/lib/Moose/Exception/MethodNameConflictInRoles.pm @@ -0,0 +1,46 @@ +package Moose::Exception::MethodNameConflictInRoles; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'conflict' => ( + traits => ['Array'], + is => 'ro', + isa => 'ArrayRef[Moose::Meta::Role::Method::Conflicting]', + handles => { conflict_methods_count => 'count', + get_method_at => 'get', + get_all_methods => 'elements', + }, + required => 1 +); + +sub _get_method_names { + my $self = shift; + + return ( $self->conflict_methods_count == 1 ? + "'".$self->get_method_at(0)->name."'": + Moose::Util::english_list( map { q{'} . $_->name . q{'} } $self->get_all_methods ) ); +} + +sub _build_message { + my $self = shift; + my $count = $self->conflict_methods_count; + my $roles = $self->get_method_at(0)->roles_as_english_list; + + if( $count == 1 ) + { + "Due to a method name conflict in roles " + .$roles.", the method ".$self->_get_method_names + ." must be implemented or excluded by '".$self->class_name."'"; + } + else + { + "Due to method name conflicts in roles " + .$roles.", the methods ".$self->_get_method_names + ." must be implemented or excluded by '".$self->class_name."'"; + } +} + +1; diff --git a/lib/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm b/lib/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm new file mode 100644 index 0000000..a724809 --- /dev/null +++ b/lib/Moose/Exception/MethodNameNotFoundInInheritanceHierarchy.pm @@ -0,0 +1,19 @@ +package Moose::Exception::MethodNameNotFoundInInheritanceHierarchy; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "The method '".$self->method_name."' was not found in the inheritance hierarchy for ".$self->class_name; +} + +1; diff --git a/lib/Moose/Exception/MethodNameNotGiven.pm b/lib/Moose/Exception/MethodNameNotGiven.pm new file mode 100644 index 0000000..e39ef0f --- /dev/null +++ b/lib/Moose/Exception/MethodNameNotGiven.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MethodNameNotGiven; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + "You must define a method name to find"; +} + +1; diff --git a/lib/Moose/Exception/MustDefineAMethodName.pm b/lib/Moose/Exception/MustDefineAMethodName.pm new file mode 100644 index 0000000..29d9114 --- /dev/null +++ b/lib/Moose/Exception/MustDefineAMethodName.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MustDefineAMethodName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +sub _build_message { + "You must define a method name"; +} + +1; diff --git a/lib/Moose/Exception/MustDefineAnAttributeName.pm b/lib/Moose/Exception/MustDefineAnAttributeName.pm new file mode 100644 index 0000000..2d818f7 --- /dev/null +++ b/lib/Moose/Exception/MustDefineAnAttributeName.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MustDefineAnAttributeName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + "You must define an attribute name"; +} + +1; diff --git a/lib/Moose/Exception/MustDefineAnOverloadOperator.pm b/lib/Moose/Exception/MustDefineAnOverloadOperator.pm new file mode 100644 index 0000000..e133c90 --- /dev/null +++ b/lib/Moose/Exception/MustDefineAnOverloadOperator.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MustDefineAnOverloadOperator; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Instance'; + +sub _build_message { + "You must define an overload operator"; +} + +1; diff --git a/lib/Moose/Exception/MustHaveAtLeastOneValueToEnumerate.pm b/lib/Moose/Exception/MustHaveAtLeastOneValueToEnumerate.pm new file mode 100644 index 0000000..0a9b599 --- /dev/null +++ b/lib/Moose/Exception/MustHaveAtLeastOneValueToEnumerate.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustHaveAtLeastOneValueToEnumerate; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must have at least one value to enumerate through"; +} + +1; diff --git a/lib/Moose/Exception/MustPassAHashOfOptions.pm b/lib/Moose/Exception/MustPassAHashOfOptions.pm new file mode 100644 index 0000000..db4a305 --- /dev/null +++ b/lib/Moose/Exception/MustPassAHashOfOptions.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustPassAHashOfOptions; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must pass a hash of options"; +} + +1; diff --git a/lib/Moose/Exception/MustPassAMooseMetaRoleInstanceOrSubclass.pm b/lib/Moose/Exception/MustPassAMooseMetaRoleInstanceOrSubclass.pm new file mode 100644 index 0000000..b18fab0 --- /dev/null +++ b/lib/Moose/Exception/MustPassAMooseMetaRoleInstanceOrSubclass.pm @@ -0,0 +1,23 @@ +package Moose::Exception::MustPassAMooseMetaRoleInstanceOrSubclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'role' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "You must pass a Moose::Meta::Role instance (or a subclass)"; +} + +1; diff --git a/lib/Moose/Exception/MustPassAPackageNameOrAnExistingClassMOPPackageInstance.pm b/lib/Moose/Exception/MustPassAPackageNameOrAnExistingClassMOPPackageInstance.pm new file mode 100644 index 0000000..7da9364 --- /dev/null +++ b/lib/Moose/Exception/MustPassAPackageNameOrAnExistingClassMOPPackageInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustPassAPackageNameOrAnExistingClassMOPPackageInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + "You must pass a package name or an existing Class::MOP::Package instance"; +} + +1; diff --git a/lib/Moose/Exception/MustPassEvenNumberOfArguments.pm b/lib/Moose/Exception/MustPassEvenNumberOfArguments.pm new file mode 100644 index 0000000..080645e --- /dev/null +++ b/lib/Moose/Exception/MustPassEvenNumberOfArguments.pm @@ -0,0 +1,24 @@ +package Moose::Exception::MustPassEvenNumberOfArguments; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'args' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "You must pass an even number of arguments to ".$self->method_name; +} + +1; diff --git a/lib/Moose/Exception/MustPassEvenNumberOfAttributeOptions.pm b/lib/Moose/Exception/MustPassEvenNumberOfAttributeOptions.pm new file mode 100644 index 0000000..090227b --- /dev/null +++ b/lib/Moose/Exception/MustPassEvenNumberOfAttributeOptions.pm @@ -0,0 +1,23 @@ +package Moose::Exception::MustPassEvenNumberOfAttributeOptions; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'options' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + return 'You must pass an even number of attribute options'; +} + +1; diff --git a/lib/Moose/Exception/MustProvideANameForTheAttribute.pm b/lib/Moose/Exception/MustProvideANameForTheAttribute.pm new file mode 100644 index 0000000..d5a48ff --- /dev/null +++ b/lib/Moose/Exception/MustProvideANameForTheAttribute.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustProvideANameForTheAttribute; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must provide a name for the attribute"; +} + +1; diff --git a/lib/Moose/Exception/MustSpecifyAtleastOneMethod.pm b/lib/Moose/Exception/MustSpecifyAtleastOneMethod.pm new file mode 100644 index 0000000..006a4e6 --- /dev/null +++ b/lib/Moose/Exception/MustSpecifyAtleastOneMethod.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MustSpecifyAtleastOneMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +sub _build_message { + "Must specify at least one method"; +} + +1; diff --git a/lib/Moose/Exception/MustSpecifyAtleastOneRole.pm b/lib/Moose/Exception/MustSpecifyAtleastOneRole.pm new file mode 100644 index 0000000..dee07fc --- /dev/null +++ b/lib/Moose/Exception/MustSpecifyAtleastOneRole.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MustSpecifyAtleastOneRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +sub _build_message { + "Must specify at least one role"; +} + +1; diff --git a/lib/Moose/Exception/MustSpecifyAtleastOneRoleToApplicant.pm b/lib/Moose/Exception/MustSpecifyAtleastOneRoleToApplicant.pm new file mode 100644 index 0000000..38c5248 --- /dev/null +++ b/lib/Moose/Exception/MustSpecifyAtleastOneRoleToApplicant.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustSpecifyAtleastOneRoleToApplicant; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'applicant' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + my $self = shift; + "Must specify at least one role to apply to ".$self->applicant; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyAClassMOPAttributeInstance.pm b/lib/Moose/Exception/MustSupplyAClassMOPAttributeInstance.pm new file mode 100644 index 0000000..d34a93d --- /dev/null +++ b/lib/Moose/Exception/MustSupplyAClassMOPAttributeInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustSupplyAClassMOPAttributeInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must supply an attribute which is a 'Class::MOP::Attribute' instance"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyADelegateToMethod.pm b/lib/Moose/Exception/MustSupplyADelegateToMethod.pm new file mode 100644 index 0000000..f86f8d2 --- /dev/null +++ b/lib/Moose/Exception/MustSupplyADelegateToMethod.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustSupplyADelegateToMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must supply a delegate_to_method which is a method name or a CODE reference"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyAMetaclass.pm b/lib/Moose/Exception/MustSupplyAMetaclass.pm new file mode 100644 index 0000000..fbb876a --- /dev/null +++ b/lib/Moose/Exception/MustSupplyAMetaclass.pm @@ -0,0 +1,19 @@ +package Moose::Exception::MustSupplyAMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "You must pass a metaclass instance if you want to inline"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyAMooseMetaAttributeInstance.pm b/lib/Moose/Exception/MustSupplyAMooseMetaAttributeInstance.pm new file mode 100644 index 0000000..83d1c72 --- /dev/null +++ b/lib/Moose/Exception/MustSupplyAMooseMetaAttributeInstance.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustSupplyAMooseMetaAttributeInstance; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must supply an attribute which is a 'Moose::Meta::Attribute' instance"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyAnAccessorTypeToConstructWith.pm b/lib/Moose/Exception/MustSupplyAnAccessorTypeToConstructWith.pm new file mode 100644 index 0000000..29b09ff --- /dev/null +++ b/lib/Moose/Exception/MustSupplyAnAccessorTypeToConstructWith.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustSupplyAnAccessorTypeToConstructWith; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must supply an accessor_type to construct with"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyAnAttributeToConstructWith.pm b/lib/Moose/Exception/MustSupplyAnAttributeToConstructWith.pm new file mode 100644 index 0000000..c43b1a7 --- /dev/null +++ b/lib/Moose/Exception/MustSupplyAnAttributeToConstructWith.pm @@ -0,0 +1,18 @@ +package Moose::Exception::MustSupplyAnAttributeToConstructWith; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must supply an attribute to construct with"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyArrayRefAsCurriedArguments.pm b/lib/Moose/Exception/MustSupplyArrayRefAsCurriedArguments.pm new file mode 100644 index 0000000..65fb9f9 --- /dev/null +++ b/lib/Moose/Exception/MustSupplyArrayRefAsCurriedArguments.pm @@ -0,0 +1,12 @@ +package Moose::Exception::MustSupplyArrayRefAsCurriedArguments; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash', 'Moose::Exception::Role::Class'; + +sub _build_message { + "You must supply a curried_arguments which is an ARRAY reference"; +} + +1; diff --git a/lib/Moose/Exception/MustSupplyPackageNameAndName.pm b/lib/Moose/Exception/MustSupplyPackageNameAndName.pm new file mode 100644 index 0000000..3533397 --- /dev/null +++ b/lib/Moose/Exception/MustSupplyPackageNameAndName.pm @@ -0,0 +1,19 @@ +package Moose::Exception::MustSupplyPackageNameAndName; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "You must supply the package_name and name parameters"; +} + +1; diff --git a/lib/Moose/Exception/NeedsTypeConstraintUnionForTypeCoercionUnion.pm b/lib/Moose/Exception/NeedsTypeConstraintUnionForTypeCoercionUnion.pm new file mode 100644 index 0000000..c19b23d --- /dev/null +++ b/lib/Moose/Exception/NeedsTypeConstraintUnionForTypeCoercionUnion.pm @@ -0,0 +1,24 @@ +package Moose::Exception::NeedsTypeConstraintUnionForTypeCoercionUnion; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +# use Moose::Util::TypeConstraints 'find_type_constraint'; + +has 'type_coercion_union_object' => ( + is => 'ro', + isa => 'Moose::Meta::TypeCoercion::Union', + required => 1 +); + +sub _build_message { + my $self = shift; + my $type_constraint = $self->type_name; + + return "You can only create a Moose::Meta::TypeCoercion::Union for a " . + "Moose::Meta::TypeConstraint::Union, not a $type_constraint" +} + +1; diff --git a/lib/Moose/Exception/NeitherAttributeNorAttributeNameIsGiven.pm b/lib/Moose/Exception/NeitherAttributeNorAttributeNameIsGiven.pm new file mode 100644 index 0000000..c482bea --- /dev/null +++ b/lib/Moose/Exception/NeitherAttributeNorAttributeNameIsGiven.pm @@ -0,0 +1,11 @@ +package Moose::Exception::NeitherAttributeNorAttributeNameIsGiven; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "You need to give attribute or attribute_name or both"; +} + +1; diff --git a/lib/Moose/Exception/NeitherClassNorClassNameIsGiven.pm b/lib/Moose/Exception/NeitherClassNorClassNameIsGiven.pm new file mode 100644 index 0000000..e6c2a41 --- /dev/null +++ b/lib/Moose/Exception/NeitherClassNorClassNameIsGiven.pm @@ -0,0 +1,11 @@ +package Moose::Exception::NeitherClassNorClassNameIsGiven; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "You need to give class or class_name or both"; +} + +1; diff --git a/lib/Moose/Exception/NeitherRoleNorRoleNameIsGiven.pm b/lib/Moose/Exception/NeitherRoleNorRoleNameIsGiven.pm new file mode 100644 index 0000000..71cd416 --- /dev/null +++ b/lib/Moose/Exception/NeitherRoleNorRoleNameIsGiven.pm @@ -0,0 +1,11 @@ +package Moose::Exception::NeitherRoleNorRoleNameIsGiven; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "You need to give role or role_name or both"; +} + +1; diff --git a/lib/Moose/Exception/NeitherTypeNorTypeNameIsGiven.pm b/lib/Moose/Exception/NeitherTypeNorTypeNameIsGiven.pm new file mode 100644 index 0000000..115adc7 --- /dev/null +++ b/lib/Moose/Exception/NeitherTypeNorTypeNameIsGiven.pm @@ -0,0 +1,11 @@ +package Moose::Exception::NeitherTypeNorTypeNameIsGiven; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "You need to give type or type_name or both"; +} + +1; diff --git a/lib/Moose/Exception/NoAttributeFoundInSuperClass.pm b/lib/Moose/Exception/NoAttributeFoundInSuperClass.pm new file mode 100644 index 0000000..3cb66ed --- /dev/null +++ b/lib/Moose/Exception/NoAttributeFoundInSuperClass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::NoAttributeFoundInSuperClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "Could not find an attribute by the name of '".$self->attribute_name."' to inherit from in ".$self->class_name; +} + +1; diff --git a/lib/Moose/Exception/NoBodyToInitializeInAnAbstractBaseClass.pm b/lib/Moose/Exception/NoBodyToInitializeInAnAbstractBaseClass.pm new file mode 100644 index 0000000..55b88c9 --- /dev/null +++ b/lib/Moose/Exception/NoBodyToInitializeInAnAbstractBaseClass.pm @@ -0,0 +1,18 @@ +package Moose::Exception::NoBodyToInitializeInAnAbstractBaseClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'package_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "No body to initialize, " .$self->package_name. " is an abstract base class"; +} + +1; diff --git a/lib/Moose/Exception/NoCasesMatched.pm b/lib/Moose/Exception/NoCasesMatched.pm new file mode 100644 index 0000000..33672a0 --- /dev/null +++ b/lib/Moose/Exception/NoCasesMatched.pm @@ -0,0 +1,26 @@ +package Moose::Exception::NoCasesMatched; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'to_match' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'cases_to_be_matched' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + my $self = shift; + my $to_match = $self->to_match; + + return "No cases matched for $to_match"; +} + +1; diff --git a/lib/Moose/Exception/NoConstraintCheckForTypeConstraint.pm b/lib/Moose/Exception/NoConstraintCheckForTypeConstraint.pm new file mode 100644 index 0000000..d50cc5c --- /dev/null +++ b/lib/Moose/Exception/NoConstraintCheckForTypeConstraint.pm @@ -0,0 +1,13 @@ +package Moose::Exception::NoConstraintCheckForTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + my $self = shift; + "Could not compile type constraint '".$self->type_name."' because no constraint check"; +} + +1; diff --git a/lib/Moose/Exception/NoDestructorClassSpecified.pm b/lib/Moose/Exception/NoDestructorClassSpecified.pm new file mode 100644 index 0000000..8d90d12 --- /dev/null +++ b/lib/Moose/Exception/NoDestructorClassSpecified.pm @@ -0,0 +1,12 @@ +package Moose::Exception::NoDestructorClassSpecified; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; + +sub _build_message { + "The 'inline_destructor' option is present, but no destructor class was specified"; +} + +1; diff --git a/lib/Moose/Exception/NoImmutableTraitSpecifiedForClass.pm b/lib/Moose/Exception/NoImmutableTraitSpecifiedForClass.pm new file mode 100644 index 0000000..2fe1c85 --- /dev/null +++ b/lib/Moose/Exception/NoImmutableTraitSpecifiedForClass.pm @@ -0,0 +1,16 @@ +package Moose::Exception::NoImmutableTraitSpecifiedForClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; + +use Moose::Util 'find_meta'; + +sub _build_message { + my $self = shift; + my $class = find_meta( $self->class_name ); + "no immutable trait specified for $class"; +} + +1; diff --git a/lib/Moose/Exception/NoParentGivenToSubtype.pm b/lib/Moose/Exception/NoParentGivenToSubtype.pm new file mode 100644 index 0000000..799320b --- /dev/null +++ b/lib/Moose/Exception/NoParentGivenToSubtype.pm @@ -0,0 +1,17 @@ +package Moose::Exception::NoParentGivenToSubtype; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "A subtype cannot consist solely of a name, it must have a parent"; +} + +1; diff --git a/lib/Moose/Exception/OnlyInstancesCanBeCloned.pm b/lib/Moose/Exception/OnlyInstancesCanBeCloned.pm new file mode 100644 index 0000000..3f0b899 --- /dev/null +++ b/lib/Moose/Exception/OnlyInstancesCanBeCloned.pm @@ -0,0 +1,19 @@ +package Moose::Exception::OnlyInstancesCanBeCloned; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; + +has 'instance' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + my $self = shift; + "You can only clone instances, (".$self->instance.") is not a blessed instance"; +} + +1; diff --git a/lib/Moose/Exception/OperatorIsRequired.pm b/lib/Moose/Exception/OperatorIsRequired.pm new file mode 100644 index 0000000..d14a846 --- /dev/null +++ b/lib/Moose/Exception/OperatorIsRequired.pm @@ -0,0 +1,18 @@ +package Moose::Exception::OperatorIsRequired; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "operator is required"; +} + +1; diff --git a/lib/Moose/Exception/OverloadConflictInSummation.pm b/lib/Moose/Exception/OverloadConflictInSummation.pm new file mode 100644 index 0000000..0292326 --- /dev/null +++ b/lib/Moose/Exception/OverloadConflictInSummation.pm @@ -0,0 +1,61 @@ +package Moose::Exception::OverloadConflictInSummation; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +use Moose::Util 'find_meta'; + +has 'role_application' => ( + is => 'ro', + isa => 'Moose::Meta::Role::Application::RoleSummation', + required => 1 +); + +has 'role_names' => ( + traits => ['Array'], + is => 'bare', + isa => 'ArrayRef[Str]', + handles => { + role_names => 'elements', + }, + required => 1, + documentation => + "This attribute is an ArrayRef containing role names, if you want metaobjects\n" + . "associated with these role names, then call method roles on the exception object.\n", +); + +has 'overloaded_op' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub roles { + my $self = shift; + my @role_names = $self->role_names; + my @roles = map { find_meta($_) } @role_names; + return @roles; +} + +sub _build_message { + my $self = shift; + + my @roles = $self->role_names; + my $role_names = join "|", @roles; + + my $op = $self->overloaded_op; + if ( $op eq 'fallback' ) { + return + 'We have encountered an overloading conflict for the fallback ' + . 'during composition. This is a fatal error.'; + } + else { + return + "Role '$role_names' has encountered an overloading conflict " + . "during composition. The two roles both overload the '$op' operator. " + . 'This is a fatal error.'; + } +} + +1; diff --git a/lib/Moose/Exception/OverloadRequiresAMetaClass.pm b/lib/Moose/Exception/OverloadRequiresAMetaClass.pm new file mode 100644 index 0000000..1f41861 --- /dev/null +++ b/lib/Moose/Exception/OverloadRequiresAMetaClass.pm @@ -0,0 +1,12 @@ +package Moose::Exception::OverloadRequiresAMetaClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + my $self = shift; + 'If you provide an associated_metaclass parameter to the Moose::Meta::Overload constructor it must be a Class::MOP::Module object'; +} + +1; diff --git a/lib/Moose/Exception/OverloadRequiresAMetaMethod.pm b/lib/Moose/Exception/OverloadRequiresAMetaMethod.pm new file mode 100644 index 0000000..67ee8ee --- /dev/null +++ b/lib/Moose/Exception/OverloadRequiresAMetaMethod.pm @@ -0,0 +1,12 @@ +package Moose::Exception::OverloadRequiresAMetaMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + my $self = shift; + 'If you provide a method parameter to the Moose::Meta::Overload constructor it must be a Class::MOP::Method object'; +} + +1; diff --git a/lib/Moose/Exception/OverloadRequiresAMetaOverload.pm b/lib/Moose/Exception/OverloadRequiresAMetaOverload.pm new file mode 100644 index 0000000..5545d74 --- /dev/null +++ b/lib/Moose/Exception/OverloadRequiresAMetaOverload.pm @@ -0,0 +1,12 @@ +package Moose::Exception::OverloadRequiresAMetaOverload; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + my $self = shift; + 'If you provide an original_overload parameter to the Moose::Meta::Overload constructor it must be a Moose::Meta::Overload object'; +} + +1; diff --git a/lib/Moose/Exception/OverloadRequiresAMethodNameOrCoderef.pm b/lib/Moose/Exception/OverloadRequiresAMethodNameOrCoderef.pm new file mode 100644 index 0000000..dd8c1f9 --- /dev/null +++ b/lib/Moose/Exception/OverloadRequiresAMethodNameOrCoderef.pm @@ -0,0 +1,12 @@ +package Moose::Exception::OverloadRequiresAMethodNameOrCoderef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + my $self = shift; + 'You must provide a method_name or coderef parameter when constructing a Moose::Meta::Overload object'; +} + +1; diff --git a/lib/Moose/Exception/OverloadRequiresAnOperator.pm b/lib/Moose/Exception/OverloadRequiresAnOperator.pm new file mode 100644 index 0000000..7952920 --- /dev/null +++ b/lib/Moose/Exception/OverloadRequiresAnOperator.pm @@ -0,0 +1,12 @@ +package Moose::Exception::OverloadRequiresAnOperator; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + my $self = shift; + 'You must provide an operator parameter when constructing a Moose::Meta::Overload object'; +} + +1; diff --git a/lib/Moose/Exception/OverloadRequiresNamesForCoderef.pm b/lib/Moose/Exception/OverloadRequiresNamesForCoderef.pm new file mode 100644 index 0000000..82401d0 --- /dev/null +++ b/lib/Moose/Exception/OverloadRequiresNamesForCoderef.pm @@ -0,0 +1,12 @@ +package Moose::Exception::OverloadRequiresNamesForCoderef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + my $self = shift; + 'If you provide a coderef parameter to the Moose::Meta::Overload constructor you must also provide coderef_package and coderef_name parameters'; +} + +1; diff --git a/lib/Moose/Exception/OverrideConflictInComposition.pm b/lib/Moose/Exception/OverrideConflictInComposition.pm new file mode 100644 index 0000000..44bfd78 --- /dev/null +++ b/lib/Moose/Exception/OverrideConflictInComposition.pm @@ -0,0 +1,42 @@ +package Moose::Exception::OverrideConflictInComposition; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'role_being_applied_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'two_overrides_found' => ( + is => 'ro', + isa => 'Bool', + required => 1, + default => 0 +); + +sub _build_message { + my $self = shift; + + if( $self->two_overrides_found ) { + return "Role '" . $self->role_being_applied_name . "' has encountered an 'override' method conflict " . + "during composition (Two 'override' methods of the same name encountered). " . + "This is a fatal error."; + } + else { + return "Role '".$self->role_being_applied_name."' has encountered an 'override' method conflict ". + "during composition (A local method of the same name as been found). ". + "This is a fatal error."; + } +} + +1; diff --git a/lib/Moose/Exception/OverrideConflictInSummation.pm b/lib/Moose/Exception/OverrideConflictInSummation.pm new file mode 100644 index 0000000..e88d9cc --- /dev/null +++ b/lib/Moose/Exception/OverrideConflictInSummation.pm @@ -0,0 +1,65 @@ +package Moose::Exception::OverrideConflictInSummation; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +use Moose::Util 'find_meta'; + +has 'role_application' => ( + is => 'ro', + isa => 'Moose::Meta::Role::Application::RoleSummation', + required => 1 +); + +has 'role_names' => ( + traits => ['Array'], + is => 'bare', + isa => 'ArrayRef[Str]', + handles => { + role_names => 'elements', + }, + required => 1, + documentation => "This attribute is an ArrayRef containing role names, if you want metaobjects\n". + "associated with these role names, then call method roles on the exception object.\n", +); + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'two_overrides_found' => ( + is => 'ro', + isa => 'Bool', + required => 1, + default => 0 +); + +sub roles { + my $self = shift; + my @role_names = $self->role_names; + my @roles = map { find_meta($_) } @role_names; + return @roles; +} + +sub _build_message { + my $self = shift; + + my @roles = $self->role_names; + my $role_names = join "|", @roles; + + if( $self->two_overrides_found ) { + return "We have encountered an 'override' method conflict ". + "during composition (Two 'override' methods of the same name encountered). ". + "This is a fatal error."; + } + else { + return "Role '$role_names' has encountered an 'override' method conflict " . + "during composition (A local method of the same name has been found). This " . + "is a fatal error." ; + } +} + +1; diff --git a/lib/Moose/Exception/PackageDoesNotUseMooseExporter.pm b/lib/Moose/Exception/PackageDoesNotUseMooseExporter.pm new file mode 100644 index 0000000..acd8ea6 --- /dev/null +++ b/lib/Moose/Exception/PackageDoesNotUseMooseExporter.pm @@ -0,0 +1,27 @@ +package Moose::Exception::PackageDoesNotUseMooseExporter; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'package' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'is_loaded' => ( + is => 'ro', + isa => 'Bool', + required => 1 +); + +sub _build_message { + my $self = shift; + my $package = $self->package; + return "Package in also ($package) does not seem to " + . "use Moose::Exporter" + . ( $self->is_loaded ? "" : " (is it loaded?)" ); +} + +1; diff --git a/lib/Moose/Exception/PackageNameAndNameParamsNotGivenToWrap.pm b/lib/Moose/Exception/PackageNameAndNameParamsNotGivenToWrap.pm new file mode 100644 index 0000000..efdb7ef --- /dev/null +++ b/lib/Moose/Exception/PackageNameAndNameParamsNotGivenToWrap.pm @@ -0,0 +1,24 @@ +package Moose::Exception::PackageNameAndNameParamsNotGivenToWrap; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'code' => ( + is => 'ro', + isa => 'CodeRef', + required => 1 +); + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "You must supply the package_name and name parameters"; +} + +1; diff --git a/lib/Moose/Exception/PackagesAndModulesAreNotCachable.pm b/lib/Moose/Exception/PackagesAndModulesAreNotCachable.pm new file mode 100644 index 0000000..901f635 --- /dev/null +++ b/lib/Moose/Exception/PackagesAndModulesAreNotCachable.pm @@ -0,0 +1,25 @@ +package Moose::Exception::PackagesAndModulesAreNotCachable; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::ParamsHash'; + +has 'is_module' => ( + is => 'ro', + isa => 'Bool', + required => 1 +); + +sub _build_message { + my $self = shift; + my $is_module = $self->is_module; + + if( $is_module ) { + return "Modules are not cacheable"; + } else { + return "Packages are not cacheable"; + } +} + +1; diff --git a/lib/Moose/Exception/ParameterIsNotSubtypeOfParent.pm b/lib/Moose/Exception/ParameterIsNotSubtypeOfParent.pm new file mode 100644 index 0000000..edc7280 --- /dev/null +++ b/lib/Moose/Exception/ParameterIsNotSubtypeOfParent.pm @@ -0,0 +1,25 @@ +package Moose::Exception::ParameterIsNotSubtypeOfParent; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +use Moose::Util::TypeConstraints qw/find_type_constraint/; + +has 'type_parameter' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $type_parameter = $self->type_parameter; + my $type = find_type_constraint( $self->type_name ); + my $parent = $type->parent->type_parameter; + + return "$type_parameter is not a subtype of $parent"; +} + +1; diff --git a/lib/Moose/Exception/ReferencesAreNotAllowedAsDefault.pm b/lib/Moose/Exception/ReferencesAreNotAllowedAsDefault.pm new file mode 100644 index 0000000..1a460c1 --- /dev/null +++ b/lib/Moose/Exception/ReferencesAreNotAllowedAsDefault.pm @@ -0,0 +1,26 @@ +package Moose::Exception::ReferencesAreNotAllowedAsDefault; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "References are not allowed as default values, you must wrap the default of '". + $self->attribute_name."' in a CODE reference (ex: sub { [] } and not [])"; +} + +1; diff --git a/lib/Moose/Exception/RequiredAttributeLacksInitialization.pm b/lib/Moose/Exception/RequiredAttributeLacksInitialization.pm new file mode 100644 index 0000000..9282048 --- /dev/null +++ b/lib/Moose/Exception/RequiredAttributeLacksInitialization.pm @@ -0,0 +1,18 @@ +package Moose::Exception::RequiredAttributeLacksInitialization; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + "A required attribute must have either 'init_arg', 'builder', or 'default'"; +} + +1; diff --git a/lib/Moose/Exception/RequiredAttributeNeedsADefault.pm b/lib/Moose/Exception/RequiredAttributeNeedsADefault.pm new file mode 100644 index 0000000..d823852 --- /dev/null +++ b/lib/Moose/Exception/RequiredAttributeNeedsADefault.pm @@ -0,0 +1,13 @@ +package Moose::Exception::RequiredAttributeNeedsADefault; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "You cannot have a required attribute (".$self->attribute_name.") without a default, builder, or an init_arg"; +} + +1; diff --git a/lib/Moose/Exception/RequiredMethodsImportedByClass.pm b/lib/Moose/Exception/RequiredMethodsImportedByClass.pm new file mode 100644 index 0000000..262883e --- /dev/null +++ b/lib/Moose/Exception/RequiredMethodsImportedByClass.pm @@ -0,0 +1,45 @@ +package Moose::Exception::RequiredMethodsImportedByClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Role'; + +has 'missing_methods' => ( + traits => ['Array'], + is => 'ro', + isa => 'ArrayRef[Moose::Meta::Role::Method::Required]', + handles => { method_count => 'count', + get_method_at => 'get', + get_all_methods => 'elements', + }, + required => 1 +); + +has 'imported_method' => ( + is => 'ro', + isa => 'Moose::Meta::Role::Method::Required', + required => 1 +); + +sub _build_message { + my $self = shift; + + my $noun = $self->method_count == 1 ? 'method' : 'methods'; + my $list = Moose::Util::english_list( map { q{'} . $_ . q{'} } $self->get_all_methods ); + + my ($class, $role, $method) = ($self->class_name, + $self->role_name, + $self->imported_method); + + my ($class_quoted, $role_quoted) = ("'".$class."'","'".$role."'"); + + "$role_quoted requires the $noun $list " + . "to be implemented by $class_quoted. " + . "If you imported functions intending to use them as " + . "methods, you need to explicitly mark them as such, via " + . "$class->meta->add_method($method" + . " => \\&$method)"; +} + +1; diff --git a/lib/Moose/Exception/RequiredMethodsNotImplementedByClass.pm b/lib/Moose/Exception/RequiredMethodsNotImplementedByClass.pm new file mode 100644 index 0000000..541c169 --- /dev/null +++ b/lib/Moose/Exception/RequiredMethodsNotImplementedByClass.pm @@ -0,0 +1,30 @@ +package Moose::Exception::RequiredMethodsNotImplementedByClass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class', 'Moose::Exception::Role::Role'; + +has 'missing_methods' => ( + traits => ['Array'], + is => 'ro', + isa => 'ArrayRef[Moose::Meta::Role::Method::Required]', + handles => { method_count => 'count', + get_method_at => 'get', + get_all_methods => 'elements', + }, + required => 1 +); + +sub _build_message { + my $self = shift; + + my $noun = $self->method_count == 1 ? 'method' : 'methods'; + my $list = Moose::Util::english_list( map { q{'} . $_ . q{'} } $self->get_all_methods ); + my ($role_name, $class_name) = ($self->role_name, $self->class_name); + + return "'$role_name' requires the $noun $list " + . "to be implemented by '$class_name'"; +} + +1; diff --git a/lib/Moose/Exception/Role/Attribute.pm b/lib/Moose/Exception/Role/Attribute.pm new file mode 100644 index 0000000..02d0c5d --- /dev/null +++ b/lib/Moose/Exception/Role/Attribute.pm @@ -0,0 +1,12 @@ +package Moose::Exception::Role::Attribute; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'attribute' => ( + is => 'ro', + isa => 'Class::MOP::Attribute', + predicate => 'is_attribute_set' +); + +1; diff --git a/lib/Moose/Exception/Role/AttributeName.pm b/lib/Moose/Exception/Role/AttributeName.pm new file mode 100644 index 0000000..b00f41e --- /dev/null +++ b/lib/Moose/Exception/Role/AttributeName.pm @@ -0,0 +1,12 @@ +package Moose::Exception::Role::AttributeName; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +1; diff --git a/lib/Moose/Exception/Role/Class.pm b/lib/Moose/Exception/Role/Class.pm new file mode 100644 index 0000000..c523997 --- /dev/null +++ b/lib/Moose/Exception/Role/Class.pm @@ -0,0 +1,14 @@ +package Moose::Exception::Role::Class; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'class_name' => ( + is => 'ro', + isa => 'Str', + required => 1, + documentation => "This attribute can be used for fetching metaclass instance:\n". + " my \$metaclass_instance = Moose::Util::find_meta( \$exception->class_name );\n", +); + +1; diff --git a/lib/Moose/Exception/Role/EitherAttributeOrAttributeName.pm b/lib/Moose/Exception/Role/EitherAttributeOrAttributeName.pm new file mode 100644 index 0000000..5b76867 --- /dev/null +++ b/lib/Moose/Exception/Role/EitherAttributeOrAttributeName.pm @@ -0,0 +1,49 @@ +package Moose::Exception::Role::EitherAttributeOrAttributeName; +our $VERSION = '2.1405'; + +use Moose::Util 'throw_exception'; +use Moose::Role; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + lazy_build => 1 +); + +has 'attribute' => ( + is => 'ro', + isa => 'Class::MOP::Attribute', + predicate => 'has_attribute' +); + +has 'params' => ( + is => 'ro', + isa => 'HashRef', + predicate => 'has_params', +); + +sub _build_attribute_name { + my $self = shift; + + if( !$self->has_attribute ) + { + throw_exception("NeitherAttributeNorAttributeNameIsGiven"); + } + + return $self->attribute->name; +} + +after "BUILD" => sub { + my $self = $_[0]; + + if( $self->has_attribute_name && + $self->has_attribute && + ( $self->attribute->name ne $self->attribute_name ) ) + { + throw_exception( AttributeNamesDoNotMatch => attribute_name => $self->attribute_name, + attribute => $self->attribute + ); + } +}; + +1; diff --git a/lib/Moose/Exception/Role/Instance.pm b/lib/Moose/Exception/Role/Instance.pm new file mode 100644 index 0000000..e3c094e --- /dev/null +++ b/lib/Moose/Exception/Role/Instance.pm @@ -0,0 +1,12 @@ +package Moose::Exception::Role::Instance; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'instance' => ( + is => 'ro', + isa => 'Object', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/InstanceClass.pm b/lib/Moose/Exception/Role/InstanceClass.pm new file mode 100644 index 0000000..e74a33f --- /dev/null +++ b/lib/Moose/Exception/Role/InstanceClass.pm @@ -0,0 +1,12 @@ +package Moose::Exception::Role::InstanceClass; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'instance_class' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/InvalidAttributeOptions.pm b/lib/Moose/Exception/Role/InvalidAttributeOptions.pm new file mode 100644 index 0000000..9a754ac --- /dev/null +++ b/lib/Moose/Exception/Role/InvalidAttributeOptions.pm @@ -0,0 +1,13 @@ +package Moose::Exception::Role::InvalidAttributeOptions; +our $VERSION = '2.1405'; + +use Moose::Role; +with 'Moose::Exception::Role::ParamsHash'; + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/Method.pm b/lib/Moose/Exception/Role/Method.pm new file mode 100644 index 0000000..b2a1f4b --- /dev/null +++ b/lib/Moose/Exception/Role/Method.pm @@ -0,0 +1,12 @@ +package Moose::Exception::Role::Method; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'method' => ( + is => 'ro', + isa => 'Moose::Meta::Method', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/ParamsHash.pm b/lib/Moose/Exception/Role/ParamsHash.pm new file mode 100644 index 0000000..02b6bf9 --- /dev/null +++ b/lib/Moose/Exception/Role/ParamsHash.pm @@ -0,0 +1,12 @@ +package Moose::Exception::Role::ParamsHash; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'params' => ( + is => 'ro', + isa => 'HashRef', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/Role.pm b/lib/Moose/Exception/Role/Role.pm new file mode 100644 index 0000000..c787234 --- /dev/null +++ b/lib/Moose/Exception/Role/Role.pm @@ -0,0 +1,16 @@ +package Moose::Exception::Role::Role; +our $VERSION = '2.1405'; + +# use Moose::Util 'throw_exception'; +use Moose::Role; + +has 'role_name' => ( + is => 'ro', + isa => 'Str', + required => 1, + documentation => "This attribute can be used for fetching metaclass instance:\n". + " my \$metaclass_instance = Moose::Util::find_meta( \$exception->role_name );\n", + +); + +1; diff --git a/lib/Moose/Exception/Role/RoleForCreate.pm b/lib/Moose/Exception/Role/RoleForCreate.pm new file mode 100644 index 0000000..23e6b12 --- /dev/null +++ b/lib/Moose/Exception/Role/RoleForCreate.pm @@ -0,0 +1,13 @@ +package Moose::Exception::Role::RoleForCreate; +our $VERSION = '2.1405'; + +use Moose::Role; +with 'Moose::Exception::Role::ParamsHash'; + +has 'attribute_class' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/RoleForCreateMOPClass.pm b/lib/Moose/Exception/Role/RoleForCreateMOPClass.pm new file mode 100644 index 0000000..a9a07c0 --- /dev/null +++ b/lib/Moose/Exception/Role/RoleForCreateMOPClass.pm @@ -0,0 +1,13 @@ +package Moose::Exception::Role::RoleForCreateMOPClass; +our $VERSION = '2.1405'; + +use Moose::Role; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +1; diff --git a/lib/Moose/Exception/Role/TypeConstraint.pm b/lib/Moose/Exception/Role/TypeConstraint.pm new file mode 100644 index 0000000..cd73986 --- /dev/null +++ b/lib/Moose/Exception/Role/TypeConstraint.pm @@ -0,0 +1,14 @@ +package Moose::Exception::Role::TypeConstraint; +our $VERSION = '2.1405'; + +use Moose::Role; + +has 'type_name' => ( + is => 'ro', + isa => 'Str', + required => 1, + documentation => "This attribute can be used for fetching type constraint(Moose::Meta::TypeConstraint):\n". + " my \$type_constraint = Moose::Util::TypeConstraints::find_type_constraint( \$exception->type_name );\n", +); + +1; diff --git a/lib/Moose/Exception/RoleDoesTheExcludedRole.pm b/lib/Moose/Exception/RoleDoesTheExcludedRole.pm new file mode 100644 index 0000000..e0f5d3a --- /dev/null +++ b/lib/Moose/Exception/RoleDoesTheExcludedRole.pm @@ -0,0 +1,27 @@ +package Moose::Exception::RoleDoesTheExcludedRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'excluded_role_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'second_role_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + my $role_name = $self->role_name; + my $excluded_role_name = $self->excluded_role_name; + return "The role $role_name does the excluded role '$excluded_role_name'"; +} + +1; diff --git a/lib/Moose/Exception/RoleExclusionConflict.pm b/lib/Moose/Exception/RoleExclusionConflict.pm new file mode 100644 index 0000000..210ec90 --- /dev/null +++ b/lib/Moose/Exception/RoleExclusionConflict.pm @@ -0,0 +1,26 @@ +package Moose::Exception::RoleExclusionConflict; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'roles' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1, +); + +sub _build_message { + my $self = shift; + + my @roles_array = @{$self->roles}; + my $role_noun = "Role".( @roles_array == 1 ? '' : 's'); + my $all_roles = join(', ', @roles_array); + my $verb = "exclude".( @roles_array == 1 ? 's' : '' ); + my $role_name = $self->role_name; + + return "Conflict detected: $role_noun $all_roles $verb role '$role_name'"; +} + +1; diff --git a/lib/Moose/Exception/RoleNameRequired.pm b/lib/Moose/Exception/RoleNameRequired.pm new file mode 100644 index 0000000..7a90e04 --- /dev/null +++ b/lib/Moose/Exception/RoleNameRequired.pm @@ -0,0 +1,12 @@ +package Moose::Exception::RoleNameRequired; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +sub _build_message { + "You must supply a role name to look for"; +} + +1; diff --git a/lib/Moose/Exception/RoleNameRequiredForMooseMetaRole.pm b/lib/Moose/Exception/RoleNameRequiredForMooseMetaRole.pm new file mode 100644 index 0000000..54f1340 --- /dev/null +++ b/lib/Moose/Exception/RoleNameRequiredForMooseMetaRole.pm @@ -0,0 +1,12 @@ +package Moose::Exception::RoleNameRequiredForMooseMetaRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +sub _build_message { + "You must supply a role name to look for"; +} + +1; diff --git a/lib/Moose/Exception/RolesDoNotSupportAugment.pm b/lib/Moose/Exception/RolesDoNotSupportAugment.pm new file mode 100644 index 0000000..91f366c --- /dev/null +++ b/lib/Moose/Exception/RolesDoNotSupportAugment.pm @@ -0,0 +1,11 @@ +package Moose::Exception::RolesDoNotSupportAugment; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "Roles cannot support 'augment'"; +} + +1; diff --git a/lib/Moose/Exception/RolesDoNotSupportExtends.pm b/lib/Moose/Exception/RolesDoNotSupportExtends.pm new file mode 100644 index 0000000..a18ceac --- /dev/null +++ b/lib/Moose/Exception/RolesDoNotSupportExtends.pm @@ -0,0 +1,11 @@ +package Moose::Exception::RolesDoNotSupportExtends; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "Roles do not support 'extends' (you can use 'with' to specialize a role)"; +} + +1; diff --git a/lib/Moose/Exception/RolesDoNotSupportInner.pm b/lib/Moose/Exception/RolesDoNotSupportInner.pm new file mode 100644 index 0000000..d075ae4 --- /dev/null +++ b/lib/Moose/Exception/RolesDoNotSupportInner.pm @@ -0,0 +1,11 @@ +package Moose::Exception::RolesDoNotSupportInner; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "Roles cannot support 'inner'"; +} + +1; diff --git a/lib/Moose/Exception/RolesDoNotSupportRegexReferencesForMethodModifiers.pm b/lib/Moose/Exception/RolesDoNotSupportRegexReferencesForMethodModifiers.pm new file mode 100644 index 0000000..89e5046 --- /dev/null +++ b/lib/Moose/Exception/RolesDoNotSupportRegexReferencesForMethodModifiers.pm @@ -0,0 +1,19 @@ +package Moose::Exception::RolesDoNotSupportRegexReferencesForMethodModifiers; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Role'; + +has 'modifier_type' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Roles do not currently support regex references for ".$self->modifier_type." method modifiers"; +} + +1; diff --git a/lib/Moose/Exception/RolesInCreateTakesAnArrayRef.pm b/lib/Moose/Exception/RolesInCreateTakesAnArrayRef.pm new file mode 100644 index 0000000..70ca26c --- /dev/null +++ b/lib/Moose/Exception/RolesInCreateTakesAnArrayRef.pm @@ -0,0 +1,13 @@ +package Moose::Exception::RolesInCreateTakesAnArrayRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +sub _build_message { + my $self = shift; + "You must pass an ARRAY ref of roles"; +} + +1; diff --git a/lib/Moose/Exception/RolesListMustBeInstancesOfMooseMetaRole.pm b/lib/Moose/Exception/RolesListMustBeInstancesOfMooseMetaRole.pm new file mode 100644 index 0000000..d06354a --- /dev/null +++ b/lib/Moose/Exception/RolesListMustBeInstancesOfMooseMetaRole.pm @@ -0,0 +1,25 @@ +package Moose::Exception::RolesListMustBeInstancesOfMooseMetaRole; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'role' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + "The list of roles must be instances of Moose::Meta::Role, not ".$self->role; +} + +1; diff --git a/lib/Moose/Exception/SingleParamsToNewMustBeHashRef.pm b/lib/Moose/Exception/SingleParamsToNewMustBeHashRef.pm new file mode 100644 index 0000000..d61073c --- /dev/null +++ b/lib/Moose/Exception/SingleParamsToNewMustBeHashRef.pm @@ -0,0 +1,11 @@ +package Moose::Exception::SingleParamsToNewMustBeHashRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "Single parameters to new() must be a HASH ref"; +} + +1; diff --git a/lib/Moose/Exception/TriggerMustBeACodeRef.pm b/lib/Moose/Exception/TriggerMustBeACodeRef.pm new file mode 100644 index 0000000..3af0d3f --- /dev/null +++ b/lib/Moose/Exception/TriggerMustBeACodeRef.pm @@ -0,0 +1,13 @@ +package Moose::Exception::TriggerMustBeACodeRef; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::InvalidAttributeOptions'; + +sub _build_message { + my $self = shift; + "Trigger must be a CODE ref on attribute (".$self->attribute_name.")"; +} + +1; diff --git a/lib/Moose/Exception/TypeConstraintCannotBeUsedForAParameterizableType.pm b/lib/Moose/Exception/TypeConstraintCannotBeUsedForAParameterizableType.pm new file mode 100644 index 0000000..337a7df --- /dev/null +++ b/lib/Moose/Exception/TypeConstraintCannotBeUsedForAParameterizableType.pm @@ -0,0 +1,24 @@ +package Moose::Exception::TypeConstraintCannotBeUsedForAParameterizableType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +has 'parent_type_name' => ( + is => 'ro', + isa => 'Str', + required => 1, + documentation => "This attribute can be used for fetching type constraint(Moose::Meta::TypeConstraint):\n". + " my \$type_constraint = Moose::Util::TypeConstraints::find_type_constraint( \$exception->parent_type_name );\n", +); + +sub _build_message { + my $self = shift; + my $type_name = $self->type_name; + my $parent_type_name = $self->parent_type_name; + "The $type_name constraint cannot be used, because " + . "$parent_type_name doesn't subtype or coerce from a parameterizable type."; +} + +1; diff --git a/lib/Moose/Exception/TypeConstraintIsAlreadyCreated.pm b/lib/Moose/Exception/TypeConstraintIsAlreadyCreated.pm new file mode 100644 index 0000000..47d36a5 --- /dev/null +++ b/lib/Moose/Exception/TypeConstraintIsAlreadyCreated.pm @@ -0,0 +1,25 @@ +package Moose::Exception::TypeConstraintIsAlreadyCreated; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +use Moose::Util::TypeConstraints 'find_type_constraint'; + +has 'package_defined_in' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + my $type_name = $self->type_name; + my $type = find_type_constraint( $type_name ); + my $type_package_defined_in = $type->_package_defined_in; + my $package_defined_in = $self->package_defined_in; + return "The type constraint '$type_name' has already been created in $type_package_defined_in and cannot be created again in $package_defined_in"; +} + +1; diff --git a/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm b/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm new file mode 100644 index 0000000..f582290 --- /dev/null +++ b/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm @@ -0,0 +1,12 @@ +package Moose::Exception::TypeParameterMustBeMooseMetaType; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::TypeConstraint'; + +sub _build_message { + "The type parameter must be a Moose meta type"; +} + +1; diff --git a/lib/Moose/Exception/UnableToCanonicalizeHandles.pm b/lib/Moose/Exception/UnableToCanonicalizeHandles.pm new file mode 100644 index 0000000..f546936 --- /dev/null +++ b/lib/Moose/Exception/UnableToCanonicalizeHandles.pm @@ -0,0 +1,19 @@ +package Moose::Exception::UnableToCanonicalizeHandles; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'handles' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +sub _build_message { + my $self = shift; + "Unable to canonicalize the 'handles' option with ".$self->handles; +} + +1; diff --git a/lib/Moose/Exception/UnableToCanonicalizeNonRolePackage.pm b/lib/Moose/Exception/UnableToCanonicalizeNonRolePackage.pm new file mode 100644 index 0000000..a6ef63a --- /dev/null +++ b/lib/Moose/Exception/UnableToCanonicalizeNonRolePackage.pm @@ -0,0 +1,19 @@ +package Moose::Exception::UnableToCanonicalizeNonRolePackage; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'handles' => ( + is => 'ro', + isa => 'Str', + required => 1, +); + +sub _build_message { + my $self = shift; + "Unable to canonicalize the 'handles' option with ".$self->handles." because its metaclass is not a Moose::Meta::Role"; +} + +1; diff --git a/lib/Moose/Exception/UnableToRecognizeDelegateMetaclass.pm b/lib/Moose/Exception/UnableToRecognizeDelegateMetaclass.pm new file mode 100644 index 0000000..1a09b9e --- /dev/null +++ b/lib/Moose/Exception/UnableToRecognizeDelegateMetaclass.pm @@ -0,0 +1,21 @@ +package Moose::Exception::UnableToRecognizeDelegateMetaclass; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'delegate_metaclass' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +sub _build_message { + my $self = shift; + my $meta = $self->delegate_metaclass; + + return "Unable to recognize the delegate metaclass '$meta'"; +} + +1; diff --git a/lib/Moose/Exception/UndefinedHashKeysPassedToMethod.pm b/lib/Moose/Exception/UndefinedHashKeysPassedToMethod.pm new file mode 100644 index 0000000..c8349bf --- /dev/null +++ b/lib/Moose/Exception/UndefinedHashKeysPassedToMethod.pm @@ -0,0 +1,24 @@ +package Moose::Exception::UndefinedHashKeysPassedToMethod; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'hash_keys' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +has 'method_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "Hash keys passed to ".$self->method_name." must be defined"; +} + +1; diff --git a/lib/Moose/Exception/UnionCalledWithAnArrayRefAndAdditionalArgs.pm b/lib/Moose/Exception/UnionCalledWithAnArrayRefAndAdditionalArgs.pm new file mode 100644 index 0000000..6aabad1 --- /dev/null +++ b/lib/Moose/Exception/UnionCalledWithAnArrayRefAndAdditionalArgs.pm @@ -0,0 +1,23 @@ +package Moose::Exception::UnionCalledWithAnArrayRefAndAdditionalArgs; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +has 'array' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +has 'args' => ( + is => 'ro', + isa => 'ArrayRef', + required => 1 +); + +sub _build_message { + "union called with an array reference and additional arguments"; +} + +1; diff --git a/lib/Moose/Exception/UnionTakesAtleastTwoTypeNames.pm b/lib/Moose/Exception/UnionTakesAtleastTwoTypeNames.pm new file mode 100644 index 0000000..282718d --- /dev/null +++ b/lib/Moose/Exception/UnionTakesAtleastTwoTypeNames.pm @@ -0,0 +1,11 @@ +package Moose::Exception::UnionTakesAtleastTwoTypeNames; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; + +sub _build_message { + "You must pass in at least 2 type names to make a union"; +} + +1; diff --git a/lib/Moose/Exception/ValidationFailedForInlineTypeConstraint.pm b/lib/Moose/Exception/ValidationFailedForInlineTypeConstraint.pm new file mode 100644 index 0000000..3ca0a7f --- /dev/null +++ b/lib/Moose/Exception/ValidationFailedForInlineTypeConstraint.pm @@ -0,0 +1,48 @@ +package Moose::Exception::ValidationFailedForInlineTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Class'; + +has 'type_constraint_message' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'attribute_name' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +has 'value' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'new_member' => ( + is => 'ro', + isa => 'Bool', + default => 0, + predicate => 'is_a_new_member' +); + +sub _build_message { + my $self = shift; + + my $line1; + + if( $self->new_member ) { + $line1 = "A new member value for ".$self->attribute_name." does not pass its type constraint because: " + } + else { + $line1 = "Attribute (".$self->attribute_name.") does not pass the type constraint because: "; + } + + return $line1 . $self->type_constraint_message; +} + +1; diff --git a/lib/Moose/Exception/ValidationFailedForTypeConstraint.pm b/lib/Moose/Exception/ValidationFailedForTypeConstraint.pm new file mode 100644 index 0000000..d09b836 --- /dev/null +++ b/lib/Moose/Exception/ValidationFailedForTypeConstraint.pm @@ -0,0 +1,32 @@ +package Moose::Exception::ValidationFailedForTypeConstraint; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::Attribute'; + +has 'value' => ( + is => 'ro', + isa => 'Any', + required => 1, +); + +has 'type' => ( + is => 'ro', + isa => Moose::Util::TypeConstraints->duck_type(["get_message", "name"]), + required => 1 +); + +sub _build_message { + my $self = shift; + + my $error = $self->type->get_message( $self->value ); + + return $error unless $self->is_attribute_set; + + my $attribute_name = $self->attribute->name; + return + "Attribute ($attribute_name) does not pass the type constraint because: $error"; +} + +1; diff --git a/lib/Moose/Exception/WrapTakesACodeRefToBless.pm b/lib/Moose/Exception/WrapTakesACodeRefToBless.pm new file mode 100644 index 0000000..d833512 --- /dev/null +++ b/lib/Moose/Exception/WrapTakesACodeRefToBless.pm @@ -0,0 +1,25 @@ +package Moose::Exception::WrapTakesACodeRefToBless; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has 'code' => ( + is => 'ro', + isa => 'Any', + required => 1 +); + +has 'class' => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "You must supply a CODE reference to bless, not (" . ( $self->code ? $self->code : 'undef' ) . ")"; +} + +1; diff --git a/lib/Moose/Exception/WrongTypeConstraintGiven.pm b/lib/Moose/Exception/WrongTypeConstraintGiven.pm new file mode 100644 index 0000000..9c3ea18 --- /dev/null +++ b/lib/Moose/Exception/WrongTypeConstraintGiven.pm @@ -0,0 +1,20 @@ +package Moose::Exception::WrongTypeConstraintGiven; +our $VERSION = '2.1405'; + +use Moose; +extends 'Moose::Exception'; +with 'Moose::Exception::Role::ParamsHash'; + +has [qw/required_type given_type attribute_name/] => ( + is => 'ro', + isa => 'Str', + required => 1 +); + +sub _build_message { + my $self = shift; + "The type constraint for ".$self->attribute_name." must be a subtype of " + .$self->required_type." but it's a ".$self->given_type; +} + +1; |