3 ms·
Is it more helpful if you will create a custom exception instead? E.g. class UnsupportedStateException : Exception
by kagaw 4y ago
Is it more helpful if you will create a custom exception instead?
E.g.
class UnsupportedStateException : Exception
- mattmanser 4y agoGenerally, no. Only you will use it in your team.
- piaste 4y agoUnreachableException 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...