Skip to content

Commit

Permalink
Merge pull request #42 from Xliff/master
Browse files Browse the repository at this point in the history
Adds optional originating information to X::Cro::Uri::ParseError
  • Loading branch information
patrickbkr authored Nov 19, 2024
2 parents c195107 + 66b03ef commit 0c05711
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/Cro/Uri.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
}
}

Expand Down Expand Up @@ -545,4 +551,4 @@ class Cro::Uri does Cro::ResourceIdentifier {
token modifier-level4 { <prefix> | '*' }
token prefix { ':' <[\x31..\x39]> \d ** 0..3 }
}
}
}

0 comments on commit 0c05711

Please sign in to comment.