▲ | zaphar 4 days ago | |||||||||||||||||||||||||
This is the "I don't care what fails nor do I wish to handle them" option. Which for some use cases may be fine. It does mean that you don't know what kinds of failures are happening nor what the proper response to them is, though. Like it or not errors are part of your domain and properly modeling them as best you can is a part of the job. Catching at the top level still means some percentage of you users are experiencing a really bad day because you didn't know that error could happen. Error modeling reduces that at the expense of developer time. | ||||||||||||||||||||||||||
▲ | dingi 4 days ago | parent | next [-] | |||||||||||||||||||||||||
Top-level error handling doesn't mean losing error details. When done well, it uses specialized exceptions and a catch–wrap–rethrow strategy to preserve stack traces and add context. Centralizing errors provides consistency, ensures all failures pass through a common pipeline for logging or user messaging, and makes policies easier to evolve without scattering handling logic across the codebase. Domain-level error modeling is still valuable where precision matters, but robust top-level handling complements it by catching the unexpected and reducing unhandled failures, striking a balance between developer effort and user experience. | ||||||||||||||||||||||||||
| ||||||||||||||||||||||||||
▲ | nromiun 4 days ago | parent | prev [-] | |||||||||||||||||||||||||
"I don't care what fails" means not catching any exception/error. My comment was the exact opposite of the idea. Top level function will bubble up every exception, no matter how deep or from which module. | ||||||||||||||||||||||||||
|