Is it good practice to inherit system exceptions besides Exception
, if it makes sense? For example, would it be sensible to inherit System.InvalidOperationException
, if my custom exception is specific kind of 'invalid operation'?
The reason I'm asking I have a number of classes that throw InvalidOperationException
with the same message. I'm considering replacing these with a custom exception which can define its own default message. If it was to inherit the InvalidOperationException
I would not have to refactor the catch
handlers.