Skip to content

std::error::Error implementation for hex::Error #258

Description

@Velnbur

It seems that elements::hex::Error is missing std::error::Error implementation, which makes it difficult to work with dynamic-error crates (like eyre or anyhow), as there default ::from method requires that.

For example,

let bytes_res = Vec::<u8>::from_hex(&raw_tx).map_err(eyre::Report::from);

doesn't compile, as eyre::Report::from requires T: std::error::Error, but:

let bytes_res = Vec::<u8>::from_hex(&raw_tx).map_err(|e| eyre::eyre!(e));

works, as it does some black-magic under the hood with the value. So still from implementation is preferable

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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