@@ -436,7 +436,7 @@ private static ParseFailureKind TryParseInternal(ReadOnlySpan<char> s, IFormatPr
436
436
if ( ( style & ~ DateTimeStyles . AllowWhiteSpaces ) != 0 )
437
437
{
438
438
result = default ;
439
- return ParseFailureKind . FormatWithParameter ;
439
+ return ParseFailureKind . Argument_InvalidDateStyles ;
440
440
}
441
441
442
442
DateTimeResult dtResult = default ;
@@ -445,13 +445,13 @@ private static ParseFailureKind TryParseInternal(ReadOnlySpan<char> s, IFormatPr
445
445
if ( ! DateTimeParse . TryParse ( s , DateTimeFormatInfo . GetInstance ( provider ) , style , ref dtResult ) )
446
446
{
447
447
result = default ;
448
- return ParseFailureKind . FormatWithOriginalDateTime ;
448
+ return ParseFailureKind . Format_BadDateOnly ;
449
449
}
450
450
451
451
if ( ( dtResult . flags & ParseFlagsDateMask ) != 0 )
452
452
{
453
453
result = default ;
454
- return ParseFailureKind . WrongParts ;
454
+ return ParseFailureKind . Format_DateTimeOnlyContainsNoneDateParts ;
455
455
}
456
456
457
457
result = new DateOnly ( DayNumberFromDateTime ( dtResult . parsedDate ) ) ;
@@ -485,7 +485,7 @@ private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, Read
485
485
if ( ( style & ~ DateTimeStyles . AllowWhiteSpaces ) != 0 )
486
486
{
487
487
result = default ;
488
- return ParseFailureKind . FormatWithParameter ;
488
+ return ParseFailureKind . Argument_InvalidDateStyles ;
489
489
}
490
490
491
491
if ( format . Length == 1 )
@@ -512,13 +512,13 @@ private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, Read
512
512
if ( ! DateTimeParse . TryParseExact ( s , format , DateTimeFormatInfo . GetInstance ( provider ) , style , ref dtResult ) )
513
513
{
514
514
result = default ;
515
- return ParseFailureKind . FormatWithOriginalDateTime ;
515
+ return ParseFailureKind . Format_BadDateOnly ;
516
516
}
517
517
518
518
if ( ( dtResult . flags & ParseFlagsDateMask ) != 0 )
519
519
{
520
520
result = default ;
521
- return ParseFailureKind . WrongParts ;
521
+ return ParseFailureKind . Format_DateTimeOnlyContainsNoneDateParts ;
522
522
}
523
523
524
524
result = new DateOnly ( DayNumberFromDateTime ( dtResult . parsedDate ) ) ;
@@ -552,7 +552,7 @@ private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, stri
552
552
if ( ( style & ~ DateTimeStyles . AllowWhiteSpaces ) != 0 || formats == null )
553
553
{
554
554
result = default ;
555
- return ParseFailureKind . FormatWithParameter ;
555
+ return ParseFailureKind . Argument_InvalidDateStyles ;
556
556
}
557
557
558
558
DateTimeFormatInfo dtfi = DateTimeFormatInfo . GetInstance ( provider ) ;
@@ -564,7 +564,7 @@ private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, stri
564
564
if ( string . IsNullOrEmpty ( format ) )
565
565
{
566
566
result = default ;
567
- return ParseFailureKind . FormatWithFormatSpecifier ;
567
+ return ParseFailureKind . Argument_BadFormatSpecifier ;
568
568
}
569
569
570
570
if ( format . Length == 1 )
@@ -597,7 +597,7 @@ private static ParseFailureKind TryParseExactInternal(ReadOnlySpan<char> s, stri
597
597
}
598
598
599
599
result = default ;
600
- return ParseFailureKind . FormatWithOriginalDateTime ;
600
+ return ParseFailureKind . Format_BadDateOnly ;
601
601
}
602
602
603
603
/// <summary>
@@ -692,11 +692,11 @@ private static void ThrowOnError(ParseFailureKind result, ReadOnlySpan<char> s)
692
692
Debug . Assert ( result != ParseFailureKind . None ) ;
693
693
switch ( result )
694
694
{
695
- case ParseFailureKind . FormatWithParameter : throw new ArgumentException ( SR . Argument_InvalidDateStyles , "style" ) ;
696
- case ParseFailureKind . FormatWithOriginalDateTime : throw new FormatException ( SR . Format ( SR . Format_BadDateOnly , s . ToString ( ) ) ) ;
697
- case ParseFailureKind . FormatWithFormatSpecifier : throw new FormatException ( SR . Argument_BadFormatSpecifier ) ;
695
+ case ParseFailureKind . Argument_InvalidDateStyles : throw new ArgumentException ( SR . Argument_InvalidDateStyles , "style" ) ;
696
+ case ParseFailureKind . Argument_BadFormatSpecifier : throw new FormatException ( SR . Argument_BadFormatSpecifier ) ;
697
+ case ParseFailureKind . Format_BadDateOnly : throw new FormatException ( SR . Format ( SR . Format_BadDateOnly , s . ToString ( ) ) ) ;
698
698
default :
699
- Debug . Assert ( result == ParseFailureKind . WrongParts ) ;
699
+ Debug . Assert ( result == ParseFailureKind . Format_DateTimeOnlyContainsNoneDateParts ) ;
700
700
throw new FormatException ( SR . Format ( SR . Format_DateTimeOnlyContainsNoneDateParts , s . ToString ( ) , nameof ( DateOnly ) ) ) ;
701
701
}
702
702
}
0 commit comments