Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Support converting error-chain into Failure::Error #284

Open
@elichai

Description

@elichai

Hi,
I use Failure::Error in my code, and when I try to use try! on a function that returns an error from the error_chain! macro by the error-chain crate it fails with the following error:

error[E0277]: `(dyn std::error::Error + std::marker::Send + 'static)` cannot be shared between threads safely                                                                                                                                                            
  --> w3utils.rs:61:19                                                                                                                                                                     
   |                                                                                                                                                                                                                                                                     
61 |         return Ok(ethabi::Contract::load(rdr)?);                                                                                                                                                                                                                    
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn std::error::Error + std::marker::Send + 'static)` cannot be shared between threads safely                                                                                                                      
   |                                                                                                                                                                                                                                                                     
   = help: the trait `std::marker::Sync` is not implemented for `(dyn std::error::Error + std::marker::Send + 'static)`                                                                                                                                                  
   = note: required because of the requirements on the impl of `std::marker::Sync` for `std::ptr::Unique<(dyn std::error::Error + std::marker::Send + 'static)>`                                                                                                         
   = note: required because it appears within the type `std::boxed::Box<(dyn std::error::Error + std::marker::Send + 'static)>`                                                                                                                                          
   = note: required because it appears within the type `std::option::Option<std::boxed::Box<(dyn std::error::Error + std::marker::Send + 'static)>>`                                                                                                                     
   = note: required because it appears within the type `error_chain::State`                                                                                                                                                                                              
   = note: required because it appears within the type `ethabi::Error`                                                                                                                                                                                                   
   = note: required because of the requirements on the impl of `failure::Fail` for `ethabi::Error`                                                                                                                                                                       
   = note: required because of the requirements on the impl of `std::convert::From<ethabi::Error>` for `failure::Error`                                                                                                                                                  
   = note: required by `std::convert::From::from` 

Now I found an issue on error-chain asking to add Sync support but it doesn't look like anyone is working on it. ( rust-lang-deprecated/error-chain#240 )
Maybe the solution can be from failure? adding some sort of From trait for the error-chain crate?

I would like to know what you guys think,
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions