Skip to content

Error return type of TryFrom<Vec<u8>> for PrivateKeyDer<'_> doesn't impl std::error::Error #88

@paulcdejean

Description

@paulcdejean

I tried the following:

    let key = PrivateKeyDer::try_from(std::fs::read(key)?)?;

And I get the error:

? couldn't convert the error: str: std::error::Error is not satisfied
the question mark operation (?) implicitly performs a conversion on the error value using the From trait
required for &str to implement std::error::Error
required for anyhow::Error to implement From<&str>

Unfortunately &str doesn't impl core::error::Error, so using it as the error return type in a try_from can cause users of the library some difficulty. It would be better to instead return a type that impls core::error::Error in the error value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-major-releasebreaking changes put off until next major release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions