2 ms·
In Python, you can simply type `raise` to re-raise the exception you caught, preserving the stack trace.
by chadzawistowski 12y ago
In Python, you can simply type `raise` to re-raise the exception you caught, preserving the stack trace.
- tacos 12y agoIn C# the equivalent is "throw;" And that's not what this article is about.
- ufmace 12y agoIn C#, throw also re-throws and preserves the stack trace in the exception object. What the article points out that it doesn't do is preserve the full call stack and method state in the Visual Studio debugger, and that only if you explicitly turn off break on throw, leaving it in break on throwing uncaught exceptions instead. In fact, changing state in an exception filter method that always returns false sounds terrible to me. What if you actually need to do something with that exception, or to clean up state? What if the Log method does something wrong that you need to debug? Exception filters are handy, but I hope to never see them used like that. Now the new null propagation operator, on the other hand, get me some of that, and I hope to see it used everywhere.