5 ms·
You can only recover from such errors locally. The local context is not available in a global exception handler.
by wallyhs 11y ago
You can only recover from such errors locally. The local context is not available in a global exception handler.
- wvenable 11y agoIf your code corrupted your data structure or a cosmic ray changed a bit, you're not recovering no matter what.
- wallyhs 11y agoThat's my point: in this situation, you can't display an error and keep going. How do you know that you are not in this situation when you catch an unknown exception?
- wvenable 11y agoBut in the same situation the code might not trigger an exception and continue just the same. You've gained or lost nothing. You have to assume that code cleans itself up as the stack unwinds. That should be normal operation whether or not you are using exceptions or not. If the exception is in the middle of modifying a data structure then the cleanup should ensure that data structure is either back into a stable state or destroyed completely.
- wallyhs 11y ago> You have to assume that code cleans itself up as the stack unwinds. Exceptions or not, if you have an unknown error condition, how can you assume anything? I apologize for the delayed response.