Currently, try:...except:... blocks are still needed to catch exceptions and wrap them in Err. We should find an API design that allows us to completely avoid this.
The issue with a simple func f(Callable[[T], R], *exceptions: E) -> Result[T,E] is that this don't allow ParamSpec to be used here, making the API not convenient on many cases.
A builder in two step could be an idea.
But how to implement a try catch in Rust?
Currently, try:...except:... blocks are still needed to catch exceptions and wrap them in
Err. We should find an API design that allows us to completely avoid this.The issue with a simple func
f(Callable[[T], R], *exceptions: E) -> Result[T,E]is that this don't allow ParamSpec to be used here, making the API not convenient on many cases.A builder in two step could be an idea.
But how to implement a try catch in Rust?