Skip to content
Permalink
Browse files

Make X::Str::Sprintf::Directives::BadType optionally better

When adding a "expected" parameter, it will show what type was expected.
  • Loading branch information...
lizmat committed Apr 7, 2019
1 parent 96a976b commit 2e8f326d092c2887033340643902fa1d1ed2a70a
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/core/Exception.pm6
@@ -2112,9 +2112,12 @@ my class X::Str::Sprintf::Directives::Unsupported is Exception {
my class X::Str::Sprintf::Directives::BadType is Exception {
has str $.type;
has str $.directive;
has str $.expected;
has $.value;
method message() {
"Directive $.directive not applicable for value of type $.type ({Rakudo::Internals.SHORT-GIST: $.value[0]})"
$.expected
?? "Directive $.directive expected a $.expected value, not a $.type ({Rakudo::Internals.SHORT-GIST: $.value[0]})"
!! "Directive $.directive not applicable for value of type $.type ({Rakudo::Internals.SHORT-GIST: $.value[0]})"
}
}

0 comments on commit 2e8f326

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