Error Handling port


I have managed to port my project mostly to rust 2018. However, there is one final problem.

I was using error_chain which is deprecated,
I can’t import the error_chain macro anymore using the new way to import macros.

I thought about moving to the failure create but that also looks abandoned as it hasn’t had a commit in the last few months.

What would people recommend ?
I have around twenty errors defined with the error_chain macro and use bail! a lot throughout mu code
I also pass around ten errors from dependencies.

Is there a recommended way to handle errors that I have missed ?



It looks like there is a workaround for error_chain here:

// Import the actual error_chain macro...
use error_chain::error_chain;

// ...and also import all the macros it uses internally
use error_chain::error_chain_processing;
use error_chain::impl_error_chain_processed;
use error_chain::impl_error_chain_kind;
use error_chain::impl_extract_backtrace;

error_chain! {

There’s currently a pull request open on the error_chain repository to fix this, so that you can just do use error_chain::error_chain.

1 Like

Also, there’s a good thread here where people discussed what the most ‘current’ way of doing error handling is.