c# - Is it possible an Exception object raising another exception due to its internal error? -
Is an exception object possible to generate an exception due to its internal error?
We catch the exception object immediately, is it possible that one exception is possible? If so, then we should try to make unlimited efforts - which looks so strange.
In short, the answer is yes, this is possible. For example - if an exception class is initialized as a large object requires that a field, but there is not enough memory to allocate it, you'll get an exception object is a Autofmomrri Aksposn
Throw.
Exceptions are like any other class and can throw exceptions themselves. There is nothing in that language which rejects it.
I would say, by throwing an exception to the exception class, this is bad behavior and it should generally be avoided.
Update: (after the renewed question)
If you are immediately converting an exception object in the try
block, Hold
hold it (assuming this is the appropriate type of exception) If you are immediately following it in the hold
block, then you hold it nested try {} { }
- This is quite common for code used in the cache, blocks which can throw exceptions.
As others have said - some exceptions should not be caught (for example, outoformy
or unexpected StackOverflow
), as you don There is no way to deal with.
Comments
Post a Comment