@@ -3161,10 +3161,10 @@ public:
3161
3161
3162
3162
auto str = strip(isoString);
3163
3163
3164
- enforce(str.length >= 15 , new DateTimeException( format(" Invalid ISO String: %s" , isoString) ));
3164
+ enforce! DateTimeException (str.length >= 15 , format(" Invalid format for DateTime.fromISOString %s" , isoString));
3165
3165
auto t = str.byCodeUnit.countUntil(' T' );
3166
3166
3167
- enforce(t != - 1 , new DateTimeException( format(" Invalid ISO String : %s" , isoString) ));
3167
+ enforce! DateTimeException (t != - 1 , format(" Invalid format for DateTime.fromISOString : %s" , isoString));
3168
3168
3169
3169
immutable date = Date .fromISOString(str[0 .. t]);
3170
3170
immutable tod = TimeOfDay .fromISOString(str[t+ 1 .. $]);
@@ -3262,10 +3262,11 @@ public:
3262
3262
3263
3263
auto str = strip(isoExtString);
3264
3264
3265
- enforce(str.length >= 15 , new DateTimeException(format(" Invalid ISO Extended String: %s" , isoExtString)));
3265
+ enforce! DateTimeException(str.length >= 15 ,
3266
+ format(" Invalid format for DateTime.fromISOExtString: %s" , isoExtString));
3266
3267
auto t = str.byCodeUnit.countUntil(' T' );
3267
3268
3268
- enforce(t != - 1 , new DateTimeException( format(" Invalid ISO Extended String : %s" , isoExtString) ));
3269
+ enforce! DateTimeException (t != - 1 , format(" Invalid format for DateTime.fromISOExtString : %s" , isoExtString));
3269
3270
3270
3271
immutable date = Date .fromISOExtString(str[0 .. t]);
3271
3272
immutable tod = TimeOfDay .fromISOExtString(str[t+ 1 .. $]);
@@ -3362,10 +3363,11 @@ public:
3362
3363
3363
3364
auto str = strip(simpleString);
3364
3365
3365
- enforce(str.length >= 15 , new DateTimeException(format(" Invalid string format: %s" , simpleString)));
3366
+ enforce! DateTimeException(str.length >= 15 ,
3367
+ format(" Invalid format for DateTime.fromSimpleString: %s" , simpleString));
3366
3368
auto t = str.byCodeUnit.countUntil(' ' );
3367
3369
3368
- enforce(t != - 1 , new DateTimeException( format(" Invalid string format: %s" , simpleString) ));
3370
+ enforce! DateTimeException (t != - 1 , format(" Invalid format for DateTime.fromSimpleString : %s" , simpleString));
3369
3371
3370
3372
immutable date = Date .fromSimpleString(str[0 .. t]);
3371
3373
immutable tod = TimeOfDay .fromISOExtString(str[t+ 1 .. $]);
@@ -7628,7 +7630,7 @@ public:
7628
7630
7629
7631
auto str = isoString.strip;
7630
7632
7631
- enforce! DateTimeException(str.length >= 8 , text(" Invalid ISO String : " , isoString));
7633
+ enforce! DateTimeException(str.length >= 8 , text(" Invalid format for Date.fromISOString : " , isoString));
7632
7634
7633
7635
int day, month, year;
7634
7636
auto yearStr = str[0 .. $ - 4 ];
@@ -7643,7 +7645,7 @@ public:
7643
7645
if (yearStr.length > 4 )
7644
7646
{
7645
7647
enforce! DateTimeException(yearStr.startsWith(' -' , ' +' ),
7646
- text(" Invalid ISO String : " , isoString));
7648
+ text(" Invalid format for Date.fromISOString : " , isoString));
7647
7649
year = to! int (yearStr);
7648
7650
}
7649
7651
else
@@ -7653,7 +7655,7 @@ public:
7653
7655
}
7654
7656
catch (ConvException)
7655
7657
{
7656
- throw new DateTimeException(text(" Invalid ISO String : " , isoString));
7658
+ throw new DateTimeException(text(" Invalid format for Date.fromISOString : " , isoString));
7657
7659
}
7658
7660
7659
7661
return Date (year, month, day);
@@ -7774,13 +7776,13 @@ public:
7774
7776
ubyte month, day;
7775
7777
7776
7778
if (str.length < 10 || str[$- 3 ] != ' -' || str[$- 6 ] != ' -' )
7777
- throw new DateTimeException(format(" Invalid ISO Extended String : %s" , isoExtString));
7779
+ throw new DateTimeException(format(" Invalid format for Date.fromISOExtString : %s" , isoExtString));
7778
7780
7779
7781
auto yearStr = str[0 .. $- 6 ];
7780
7782
auto signAtBegining = cast (bool ) yearStr.startsWith(' -' , ' +' );
7781
7783
if ((yearStr.length > 4 ) != signAtBegining)
7782
7784
{
7783
- throw new DateTimeException(format(" Invalid ISO Extended String : %s" , isoExtString));
7785
+ throw new DateTimeException(format(" Invalid format for Date.fromISOExtString : %s" , isoExtString));
7784
7786
}
7785
7787
7786
7788
try
@@ -7791,7 +7793,7 @@ public:
7791
7793
}
7792
7794
catch (ConvException)
7793
7795
{
7794
- throw new DateTimeException(format(" Invalid ISO Extended String : %s" , isoExtString));
7796
+ throw new DateTimeException(format(" Invalid format for Date.fromISOExtString : %s" , isoExtString));
7795
7797
}
7796
7798
7797
7799
return Date (year, month, day);
@@ -7910,7 +7912,7 @@ public:
7910
7912
auto str = strip(simpleString);
7911
7913
7912
7914
if (str.length < 11 || str[$- 3 ] != ' -' || str[$- 7 ] != ' -' )
7913
- throw new DateTimeException(format! " Invalid string format: %s" (simpleString));
7915
+ throw new DateTimeException(format! " Invalid format for Date.fromSimpleString : %s" (simpleString));
7914
7916
7915
7917
int year;
7916
7918
uint day;
@@ -7919,7 +7921,7 @@ public:
7919
7921
auto signAtBegining = cast (bool ) yearStr.startsWith(' -' , ' +' );
7920
7922
if ((yearStr.length > 4 ) != signAtBegining)
7921
7923
{
7922
- throw new DateTimeException(format! " Invalid string format: %s" (simpleString));
7924
+ throw new DateTimeException(format! " Invalid format for Date.fromSimpleString : %s" (simpleString));
7923
7925
}
7924
7926
7925
7927
try
@@ -7929,7 +7931,7 @@ public:
7929
7931
}
7930
7932
catch (ConvException)
7931
7933
{
7932
- throw new DateTimeException(format! " Invalid string format: %s" (simpleString));
7934
+ throw new DateTimeException(format! " Invalid format for Date.fromSimpleString : %s" (simpleString));
7933
7935
}
7934
7936
7935
7937
return Date (year, month, day);
@@ -9208,7 +9210,7 @@ public:
9208
9210
int hours, minutes, seconds;
9209
9211
auto str = strip(isoString);
9210
9212
9211
- enforce! DateTimeException(str.length == 6 , text(" Invalid ISO String : " , isoString));
9213
+ enforce! DateTimeException(str.length == 6 , text(" Invalid format for TimeOfDay.fromISOString : " , isoString));
9212
9214
9213
9215
try
9214
9216
{
@@ -9220,7 +9222,7 @@ public:
9220
9222
}
9221
9223
catch (ConvException)
9222
9224
{
9223
- throw new DateTimeException(text(" Invalid ISO String : " , isoString));
9225
+ throw new DateTimeException(text(" Invalid format for TimeOfDay.fromISOString : " , isoString));
9224
9226
}
9225
9227
9226
9228
return TimeOfDay (hours, minutes, seconds);
@@ -9333,7 +9335,7 @@ public:
9333
9335
int hours, minutes, seconds;
9334
9336
9335
9337
if (str.length != 8 || str[2 ] != ' :' || str[5 ] != ' :' )
9336
- throw new DateTimeException(text(" Invalid ISO Extended String : " , isoExtString));
9338
+ throw new DateTimeException(text(" Invalid format for TimeOfDay.fromISOExtString : " , isoExtString));
9337
9339
9338
9340
try
9339
9341
{
@@ -9345,7 +9347,7 @@ public:
9345
9347
}
9346
9348
catch (ConvException)
9347
9349
{
9348
- throw new DateTimeException(text(" Invalid ISO Extended String : " , isoExtString));
9350
+ throw new DateTimeException(text(" Invalid format for TimeOfDay.fromISOExtString : " , isoExtString));
9349
9351
}
9350
9352
9351
9353
return TimeOfDay (hours, minutes, seconds);
0 commit comments