tarpc icon indicating copy to clipboard operation
tarpc copied to clipboard

Consider error story

Open tikue opened this issue 8 years ago • 1 comments

It looks like Failure is positioning itself as the successor to libstd's error trait.

tikue avatar Nov 06 '17 23:11 tikue

Update: I've torn out all custom errors for now and am just using io::Error for errors in the framework stack. This is not intended to be super long-term, but I also don't have any short-term plans to fix it.

service!s are still free to use whatever error types they want. In practice, this means that if you define rpc foo() -> Result<Bar, CustomError>;, then await!(client.foo(context::current())) evaluates to type io::Result<Result<Bar, CustomError>>. This isn't great, but I also don't feel awful about it, because I think users will typically just propagate the io::Error with the ? operator.

Other options:

  1. Require rpc definitions to always specify a result type, and require the error type to impl From<io::Error> (or From<tarpc::Error>, if I ever do that).

This feels like a hindrance to users doing simple things without results, like rpc foo() -> String;. Also, it's unclear to me that I could come up with a tarpc::Error that is any better than io::Error, because it's still going to be a grab-bag of failure modes.

tikue avatar Oct 29 '18 22:10 tikue

This was resolved back in d0c11a6efaa6c86b6735feb36f4979e050691b68

tikue avatar Feb 05 '24 02:02 tikue