Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Cross committed May 2, 2019
1 parent 86145cd commit e13b623
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lotto.pm
Expand Up @@ -116,10 +116,12 @@ around BUILDARGS => sub {
}
}
unless (defined $count) {
push @errs, "Neither $first nor $second look like a positive integer";
push @errs,
"Neither '$first' nor '$second' look like a positive integer";
}
unless (defined $type) {
push @errs, "Neither $first nor $second are a recognised type of lottery";
push @errs,
"Neither '$first' nor '$second' are a recognised type of lottery";
}
}

Expand All @@ -129,7 +131,7 @@ around BUILDARGS => sub {

if (@_ || @errs) {
push @errs, 'Usage: lotto [' .
join('|', keys %{$class->config}) .
join('|', sort keys %{$class->config}) .
"] [count]\n";
die join "\n", @errs;
}
Expand Down

0 comments on commit e13b623

Please sign in to comment.