Skip to content

Commit

Permalink
make Str.Numeric throw typed exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
moritz committed May 25, 2012
1 parent 90fd1b9 commit 1143b27
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/Str.pm
Expand Up @@ -214,8 +214,13 @@ my class Str does Stringy {
$eos = nqp::add_i($end, 1);

# Fail all the way out when parse failures occur
my &parse_fail := -> $msg { fail $msg, ' at position ',
$pos, " of '", ~$str, "'" };
my &parse_fail := -> $msg {
fail X::Str::Numeric.new(
source => self,
reason => $msg,
:$pos,
);
};

my sub parse-simple-number () {
# Handle NaN here, to make later parsing simpler
Expand Down

0 comments on commit 1143b27

Please sign in to comment.