rust-lang-deprecated / error-chain

Error boilerplate for Rust
Apache License 2.0
729 stars 111 forks source link

Add ResultExt::from_err() wrt #119 #162

Closed hasufell closed 6 years ago

hasufell commented 7 years ago

Is that ok? The macros are so complex I don't really know. But it compiles and works in my own project as expected. Also, didn't add any tests.

bennyyip commented 7 years ago

I like this PR, should we merge it?

Yamakaky commented 7 years ago

I don't really like the method name. Maybe something like convert or convert_error?

hasufell commented 7 years ago

I have no strong opinion on the function name. This is just the best I could come up with.

Yamakaky commented 7 years ago

There is a lot of _err in std (Result::err, unwrap_err, is_err), so I think convert_err would be appropriate.

Yamakaky commented 7 years ago

Also, could you update the changelog, add a test and update the doc/examples ?

bennyyip commented 7 years ago

@Yamakaky futures use from_err too, maybe follow this name is easier to understand. https://docs.rs/futures/0.1.14/futures/future/trait.Future.html#method.from_err.

Yamakaky commented 7 years ago

Right!

Yamakaky commented 6 years ago

Also, could you update the changelog, add a test and update the doc/examples ?

^^

hasufell commented 6 years ago

I tried to rebase this patch against master, but the addition of Option impl broke this patch.

No idea who thought that is a good idea. Even the documentation of the trait is wrong now.

https://github.com/rust-lang-nursery/error-chain/blob/master/src/error_chain.rs#L334

hasufell commented 6 years ago

Abandoning.