mockersf / jenkins-api.rs

Rust client for Jenkins API
MIT License
26 stars 17 forks source link

Re-export failure::Error #48

Closed kunicmarko20 closed 3 years ago

kunicmarko20 commented 4 years ago

https://github.com/mockersf/jenkins-api.rs/blob/cc9cf628f54c75bfa7f7672f5d76a9b25b610a48/src/client_internals/builder.rs#L48

This method returns failure::Error but that type is not re-exported, meaning I have to remap the error and can't just add it as a type to a fn.

Would be great if this can be re-exported so I don't have to add that crate as a dependency.

mockersf commented 4 years ago

I removed the dependency to failure in branch failure.

Would that work for you ?

kunicmarko20 commented 4 years ago

That works, thanks!

The only thing I would suggest is a result type to avoid repeating the same error everywhere:

type Result<T> = Result<T, Box<dyn std::error::Error>>
otavio commented 4 years ago

Now we get:

65 |                 let build = build.get_full_build(&jenkins)?;
   |                                                           ^ `dyn std::error::Error` cannot be sent between threads safely