Permalink
Browse files

another typed exception for DateTime

  • Loading branch information...
1 parent d351efc commit cad7b6c29c3529fd8109a36bbb4e609b1a0e6ba1 @moritz moritz committed Jun 4, 2012
Showing with 6 additions and 1 deletion.
  1. +5 −0 src/core/Exception.pm
  2. +1 −1 src/core/Temporal.pm
View
@@ -834,6 +834,11 @@ my class X::Temporal::Truncation is X::Temporal {
"in $.class.truncated-to: $.error";
}
}
+my class X::DateTime::TimezoneClash is X::Temporal {
+ method message() {
+ 'DateTime.new(Str): :timezone argument not allowed with a timestamp offset';
+ }
+}
my class X::Eval::NoSuchLang is Exception {
has $.lang;
View
@@ -282,7 +282,7 @@ my class DateTime does Dateish {
my $second = +$5;
if $6 {
$timezone
- and die "DateTime.new(Str): :timezone argument not allowed with a timestamp offset";
+ and X::DateTime::TimezoneClash.new.throw;
if $6 eq 'Z' {
$timezone = 0;
} else {

0 comments on commit cad7b6c

Please sign in to comment.