Skip to content

Commit

Permalink
Provide ungraceful fallback
Browse files Browse the repository at this point in the history
Fail if unknown timezone — no one should be using one of these anyways
  • Loading branch information
alabamenhu committed Jan 26, 2021
1 parent 4f94570 commit 7a201a1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/DateTime/Timezones/Routines.pm6
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ sub get-timezone-data($olson-id) is export {
.return with %cache{$olson-id};

use DateTime::Timezones::State;
%cache{$olson-id} := State.new:
%?RESOURCES{"TZif/$olson-id"}.slurp(:bin), :name($olson-id);
# TODO more gracefully handle this
with %?RESOURCES{"TZif/$olson-id"}.slurp(:bin) {
return %cache{$olson-id} := State.new: $_, :name($olson-id)
}else{
die "Unknown timezone $olson-id";
}
}


Expand Down

0 comments on commit 7a201a1

Please sign in to comment.