Modified exception thrown in default case with Pattern Matching.
MODIFY
src/Chapter07/Listing07.24.SwitchWithPatternMatching.cs
src/Chapter07/Listing07.24.SwitchWithPatternMatching.cs
@@ -28,7 +28,8 @@ namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter07.Listing07_24
case HardDrive hardDrive:
throw new InvalidOperationException();
default: // The location of case default doesn't matter
- throw new ArgumentException(nameof(storage));
+ throw new InvalidOperationException(
+ $"The storage type { storage.GetType() } is not handled.");
}
}
}

Modified exception thrown in default case with Pattern Matching.