Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 9 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 35 additions and 29 deletions.
  1. +35 −29 S32-setting-library/Exception.pod
View
64 S32-setting-library/Exception.pod
@@ -17,8 +17,8 @@ Authors of previous versions of this document:
Created: 26 Feb 2009
- Last Modified: 2 August 2012
- Version: 13
+ Last Modified: 17 August 2012
+ Version: 20
The document is a draft.
@@ -178,8 +178,9 @@ Thrown when C<chmod> fails.
=head2 X::NYI
- role X::NYI {
+ class X::NYI is Exception {
has $.feature;
+ method message() { "$.feature is not yet implemented. Sorry. " }
}
For errors that stem from incomplete implementations of the Perl 6 language.
@@ -225,7 +226,7 @@ For exceptions that can occur both at run time and at compile time, the base
exception type should not do C<X::Comp>, but it should be mixed in into
the exception object when thrown at compile time.
-=head3 X::Placedholder::Block
+=head3 X::Placeholder::Block
Thrown when a placeholder variable is used in a block that does not allow a
signature (for example C<class A { $^foo }>.
@@ -242,27 +243,12 @@ signature (for example C<class A { $^foo }>.
Thrown when a placeholder variable is used in the mainline, ie outside of any
explicit block.
- my class X::Placeholder::Mainline does X::Comp {
- has $.placeholder;
+ my class X::Placeholder::Mainline is X::Placeholder::Block {
method message() {
"Cannot use placeholder parameter $.placeholder in the mainline"
}
}
-=head3 X::Attribute::Undeclared
-
-Thrown when an undeclared attribute is being referenced.
-TODO: include the actual package, not the package name.
-
- my class X::Attribute::Undeclared does X::Comp {
- has $.name;
- has $.package-type;
- has $.package-name;
- method message() {
- "Attribute $.name not declared in $.package-type $.package-name";
- }
- }
-
=head3 X::Redeclaration
Thrown when a symbol is redeclared
@@ -288,6 +274,18 @@ Occurs when a symbol is being referenced that needs to be declared, but isn't.
}
}
+=head3 X::Attribute::Undeclared
+
+Thrown when an undeclared attribute is being referenced.
+
+ my class X::Attribute::Undeclared is X::Undeclared {
+ has $.package-kind;
+ has $.package-name;
+ method message() {
+ "Attribute $.name not declared in $.package-kind $.package-name";
+ }
+ }
+
=head3 X::Phaser::Multiple
Thrown when multiple phasers of the same type occur in a block, but only one
@@ -305,9 +303,15 @@ example on mandatory parameters.
my class X::Parameter::Default does X::Comp {
has $.how;
- method message() { "Cannot put default on $.how parameter" };
+ has $.parameter;
+ method message() {
+ $.parameter
+ ?? "Cannot put default on $.how parameter $.parameter"
+ !! "Cannot put default on anonymous $.how parameter";
+ }
}
+
=head3 X::Parameter::Placeholder
Thrown when the user tries to use a placeholder as a formal parameter.
@@ -339,8 +343,9 @@ Thrown when an illegal twigil is used in a formal parameter.
Thrown for multiple prefix type constraints like C<Int Str $x>.
my class X::Parameter::MultipleTypeConstraints does X::Comp {
+ has $.parameter;
method message() {
- "A parameter may only have on prefix type constraint";
+ qq[{"Parameter $.parameter" || 'A parameter'} may only have one prefix type constraint];
}
}
@@ -351,9 +356,10 @@ example optional before mandatory parameters).
my class X::Parameter::WrongOrder does X::Comp {
has $.misplaced;
+ has $.parameter;
has $.after;
method message() {
- "Cannot put $.misplaced parameter after $.after parameters";
+ "Cannot put $.misplaced parameter $.parameter after $.after parameters";
}
}
@@ -412,8 +418,8 @@ Thrown when trying to declare an attribute inside a package which doesn't
support attributes.
my class X::Attribute::Package does X::Comp {
- has $.package-type;
- method message() { "A $.package-type cannot have attributes" }
+ has $.package-kind;
+ method message() { "A $.package-kind cannot have attributes" }
}
=head3 X::Attribute::NoPackage
@@ -471,8 +477,8 @@ Thrown when an anonymous multi is being declared.
Thrown when trying to augment an anonymous package.
my class X::Anon::Augment does X::Comp {
- has $.package-type;
- method message() { "Cannot augment anonymous $.package-type" }
+ has $.package-kind;
+ method message() { "Cannot augment anonymous $.package-kind" }
}
=head3 X::Augment::NoSuchType
@@ -480,9 +486,9 @@ Thrown when trying to augment an anonymous package.
Thrown when trying to agument a type which doesn't exist.
my class X::Augment::NoSuchType does X::Comp {
- has $.package-type;
+ has $.package-kind;
has $.package;
- method message() { "You tried to augment $.package-type $.package, but it does not exist" }
+ method message() { "You tried to augment $.package-kind $.package, but it does not exist" }
}
=head3 X::Package::Stubbed

No commit comments for this range

Something went wrong with that request. Please try again.