diff --git a/lib/Cro/Uri.pm6 b/lib/Cro/Uri.pm6 index 614b49c..6416bbe 100644 --- a/lib/Cro/Uri.pm6 +++ b/lib/Cro/Uri.pm6 @@ -11,8 +11,14 @@ package EXPORT::decode-percents { class X::Cro::Uri::ParseError is Exception { has $.reason = 'malformed syntax'; has $.uri-string is required; + has $.origin; + method message() { - "Unable to parse URI '$!uri-string': $!reason" + [~]( + "Unable to parse URI '$!uri-string'", + ($.origin ?? " from { $!origin }" !! ''), + ": $!reason" + ) } } @@ -548,4 +554,4 @@ class Cro::Uri does Cro::ResourceIdentifier { token modifier-level4 { | '*' } token prefix { ':' <[\x31..\x39]> \d ** 0..3 } } -} \ No newline at end of file +}