Permalink
Browse files

Exception.fail

  • Loading branch information...
1 parent 39087ad commit 1180041d53e79fd0139736e28ffe214081789d77 @moritz moritz committed Jun 29, 2012
Showing with 10 additions and 0 deletions.
  1. +1 −0 docs/ChangeLog
  2. +9 −0 src/core/Exception.pm
View
@@ -3,6 +3,7 @@ New in 2012.07
+ Ranges can now interpolate in argument lists
+ The built-in meta-objects (such as Metamodel::ClassHOW) now inherit from Any
+ &open now supports :enc/:encoding
++ Exception.fail
New in 2012.06
+ Rakudo is now compiled with the same regex engine as user-space regexes use
View
@@ -1,3 +1,4 @@
+my class Failure { ... }
my role X::Comp { ... }
my class X::ControlFlow { ... }
@@ -32,6 +33,14 @@ my class Exception {
pir::setattribute__vPsP($!ex, 'payload', nqp::p6decont(self));
nqp::rethrow($!ex)
}
+
+ method fail(Exception:D:) {
+ try self.throw;
+ my $fail := Failure.new($!);
+ my Mu $return := pir::find_caller_lex__Ps('RETURN');
+ $return($fail) unless nqp::isnull($return);
+ $fail
+ }
}
my class X::AdHoc is Exception {

0 comments on commit 1180041

Please sign in to comment.