Skip to content

How do you use Query::Error? #98

Open
@antifuchs

Description

@antifuchs

I'm intrigued by bounce & am trying to make my own query hoping to propagate error along to my rendered components! But unfortunately, I do not see how I could do that without great toil: I'm using a reqwest client (to be precise, a client generated by progenitor), which returns errors that are neither PartialEq nor Clone, nor std::error::Error.

So I thought, hah, let's just use anyhow; it does all the reasonable error wrapping with minimal headache. Turns out, anyhow doesn't impl PartialEq either.

The best/easiest I could come up with is this, but I don't love it (sorry for the name, hah):

#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
#[error("{}", .0)]
struct GoddamnIt(String);

impl GoddamnIt {
    fn new<E>(error: E) -> Self
    where
        E: ToString,
    {
        GoddamnIt(error.to_string())
    }
}

Do you have hints / recommendations on what to do that would help preserve the identifiability of my errors, or do you think the requirements for the Error associated type can be loosened?

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