Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Routine.unwrap now throws a typed exception
  • Loading branch information
moritz committed Feb 27, 2012
1 parent 409db17 commit d696855
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/Exceptions.pm
Expand Up @@ -317,3 +317,7 @@ my class X::Augment::NoSuchType does X::Comp {
has $.package;
method message() { "You tried to agument $.package-type $.package, but it does not exist" }
}

my class X::Routine::Unwrap is Exception {
method message() { "Invalid wrap handle passed to routine" }
}
4 changes: 3 additions & 1 deletion src/core/Routine.pm
@@ -1,3 +1,5 @@
my class X::Routine::Unwrap { ... }

my class Routine {
method of() { self.signature.returns }
method returns() { self.signature.returns }
Expand Down Expand Up @@ -86,7 +88,7 @@ my class Routine {

method unwrap($handle) {
$handle.can('restore') && $handle.restore() ||
die("Invalid wrap handle passed to routine")
die(X::Routine::Unwrap.new())
}

method yada() {
Expand Down

0 comments on commit d696855

Please sign in to comment.