Skip to content
Permalink
Browse files

Add "addendum" to X::Method::NotFound

So we can give better error messages for specific cases.
  • Loading branch information...
lizmat committed Dec 31, 2018
1 parent c9fe946 commit 04dd52f9fcc3e0f1dcefd739224c56e1bd47c017
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/Exception.pm6
@@ -146,6 +146,7 @@ my class X::Method::NotFound is Exception {
has $.method;
has $.typename;
has Bool $.private = False;
has $.addendum;
method message() {
my $message = $.private
?? "No such private method '!$.method' for invocant of type '$.typename'"
@@ -195,7 +196,9 @@ my class X::Method::NotFound is Exception {
$message ~= ". Did you mean any of these?\n { %suggestions.sort(*.value)>>.key.head(4).join("\n ") }\n";
}

$message;
$.addendum
?? "$message\n$.addendum"
!! $message
}
}

0 comments on commit 04dd52f

Please sign in to comment.
You can’t perform that action at this time.