language agnostic - Are exception hierarchies really useful? -


It seemed to me that I have never seen an exception hierarchy for which the parent class The catch was really useful (of course, for the base exception class, which is is to be derived.)

The exception hierarchies are really useful, the excerpts are all exceptions to the language Should the base be obtained from the exception class?

Exception hierarchies are useful for grouping related exceptions together, when you have different locations But different granularities are needed to catch on.

In all places, it is a matter of general use to adopt all the exceptions. This allows you to catch MyAppException at any time all errors are coming from your application, but still, to hold more specific exceptions when appropriate . (In the .NET, ApplicationException class was for this, but it was disliked for various reasons.)

But you can also add exceptions to the limitations of the module, or In any other way that makes sense, use FooModuleException for exceptions coming from the Foo module, but FooModuleMustFrobnicate specifically interiors Hold and handle Foo . Or any equivalent status

I have used all these patterns at different times.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -