Not OP, but as someone who likes this style of exception handling, I really appreciate that it offloads everything to the type system.
With normal exceptions, I have to use my meat brain to figure out if I've handled all the exceptions that might come up, whereas mypy can just tell me if I've handled the result object correctly
That said, I don't use either library since, in my experience, you need them to be used all the way down the stack to actually get the benefit.
I have to use my meat brain to figure out if I've handled all the exceptions that might come up
The point of exceptions is exactly that you don't want to handle all that might come up -- you need to handle only those that you actually expect and know how to handle. Everything else is left to bubble up and either be handled by a custom, generic top-level handler, or by the language's default mechanism (in Python's case, dumping a stack trace).
Comments
Not OP, but as someone who likes this style of exception handling, I really appreciate that it offloads everything to the type system.
With normal exceptions, I have to use my meat brain to figure out if I've handled all the exceptions that might come up, whereas mypy can just tell me if I've handled the result object correctly
That said, I don't use either library since, in my experience, you need them to be used all the way down the stack to actually get the benefit.
The point of exceptions is exactly that you don't want to handle all that might come up -- you need to handle only those that you actually expect and know how to handle. Everything else is left to bubble up and either be handled by a custom, generic top-level handler, or by the language's default mechanism (in Python's case, dumping a stack trace).
Ahhh, I get it now, thank you!