3 ms·
UnreachableException has no special behaviour at all [0]. It's just a standardized 'tag' around regular Exception. The only advantage of using a standard tag i
by piaste 4y ago
UnreachableException has no special behaviour at all [0]. It's just a standardized 'tag' around regular Exception.
The only advantage of using a standard tag is that it will be recognized by other programmers, and maybe some supporting tooling might choose to give it special treatment.
E.g. a code analyzer could warn you if you raise a NotImplementedException (forgot to finish a feature?), but accept an UnreachableException as valid.
If you want to add a custom name (for easier grepping maybe?) or stuff some extra data in the exception, you can still inherit from UnreachableException.
[0] https://github.com/dotnet/runtime/pull/63922/files#diff-588cbfdddf3a32e17c0ab9e23da1001e42c28892c535171f5e457a7fe92d8a9d https://github.com/dotnet/runtime/pull/63922/files#diff-588c...