5 ms·
> Fortunately, .NET 7 adds a new type to help us out here: UnreachableException. There was an UnreachableException before .NET 7 as well. Look: public class
by dustedcodes 4y ago
> Fortunately, .NET 7 adds a new type to help us out here: UnreachableException.
There was an UnreachableException before .NET 7 as well.
Look:
public class UnreachableException : Exception {}
- codeflo 4y agoUnderrated comment. I’m all for precisely modeling domain and I/O errors. But for “this is a bug” type of exceptions, what good do all those tiny variations (and the resulting philosophical debates about when to use which one) do, if all that changes in practice is the text of log message? You’ll never catch that one specifically or treat it any differently than an ArgumentNullException — or any other of the zillion already existing ones.
- jve 4y agoWhen opening article, I was thinking: hey, maybe they introduced some compile-time checks for this special exception type? Like switching non-exhaustive list of enums and default:ing with UnreachableException... Errm, maybe not.
- fkarg 4y agoit helps significantly for debugging
- codeflo 4y ago> all that changes in practice is the text of log message