Last active
November 2, 2015 23:05
-
-
Save usev6/bac193a8b7219490993c to your computer and use it in GitHub Desktop.
Prevent "Method 'Int' not found for invocant of class 'Any'"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Failure.pm b/src/core/Failure.pm | |
index 70aa7be..4a7baff 100644 | |
--- a/src/core/Failure.pm | |
+++ b/src/core/Failure.pm | |
@@ -56,7 +56,7 @@ my class Failure { | |
multi method Str(Failure:D:) { $!handled ?? $.mess !! self!throw(); } | |
multi method gist(Failure:D:) { $!handled ?? $.mess !! self!throw(); } | |
method mess (Failure:D:) { | |
- "(HANDLED) " x $!handled ~ self.exception.message ~ "\n" ~ self.backtrace; | |
+ "(HANDLED) " x ($!handled ?? $!handled !! 0) ~ self.exception.message ~ "\n" ~ self.backtrace; | |
} | |
method sink(Failure:D:) { |
making $!handled a native int also seems to have done the trick
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aha, just saw: 'method mess' is called from 'submethod DESTROY' and yes, $!handled is not True in that case.
On the other hand it's still not clear why we hit 'submethod DESTROY' at all.