Vexing Exceptions
Posted3 months agoActive3 months ago
ericlippert.comTechstory
calmpositive
Debate
20/100
Exception HandlingProgrammingSoftware Design
Key topics
Exception Handling
Programming
Software Design
The article discusses the different types of exceptions in programming and how to handle them effectively, with commenters sharing their own experiences and insights on exception handling best practices.
Snapshot generated from the HN discussion
Discussion Activity
Light discussionFirst comment
5h
Peak period
4
30-33h
Avg / period
1.8
Comment distribution14 data points
Loading chart...
Based on 14 loaded comments
Key moments
- 01Story posted
Oct 9, 2025 at 10:54 PM EDT
3 months ago
Step 01 - 02First comment
Oct 10, 2025 at 3:42 AM EDT
5h after posting
Step 02 - 03Peak activity
4 comments in 30-33h
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 11, 2025 at 4:45 PM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45535014Type: storyLast synced: 11/20/2025, 2:46:44 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
Perhaps it's an artifact of C#, exceptions are built into the language and sufficient user error handling mechanisms are not. You get some `Try*()` methods but often don't have as much error information as you'd like.
You can mimic Rust's `Result` pattern in C# without much trouble and I've found that to be a good way to go. The biggest downside is the lack of namespace-level typedefs so you always have to include that TError parameter. It's a small price to pay.
1. Exception overhead. Exceptions capture diagnostics and unwind stacks in ways that add cost to the user-error case.
2. Type system information. With the result type, you declare the possibility to fail, and exactly what failures to expect in normal operation. You can switch over specific errors vs the broad category of anything that inherits from `Exception`
Catching (and not logging) the exception would conceal the bug, but I wouldn't want to get rid of the stacktrace that comes with throwing the exception - that is extremely useful for narrowing down the location of the bug.
Incidentally, that's something I've never understood in the "Go style error handling" crowd. The default behavior - if you ignore the return value - in those languages is exactly equivalent to catching and silently throwing away an exception - the thing that's universally understood to be a bad idea. Whereas the default behavior in languages with exceptions is to print the error and exit the program - which us usually seen as the safest choice, unless you have more information and can recover from the exception.
So if go-style error handling makes it easier to do the bad thing instead of the good thing, why would it still be the superior form of error handling?
I agree that errors handling as it is implemented in Go is error-prone. Rust does this much better - values of a Result type shouldn't be discarded.
Just printing a warning is not always appropriate. The code would continue to work and produce invalid data and actions.
For that, you'd have to know the location in the first place, which you usually don't.
Yes there is something: you can design an exception handling system which lets your code specify choices about what to do if such an exception occurs within its contour. Those choices provide ways of passing control to that code.
Then the next layers above the code can decide whether to take those choices, or some other similar choices available from eslewhere, or let the exception bubble up, possibly leaving it unhandled.
The article is a decent tutorial for working with Blub exceptions, but it's limited to that.