Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you use Query::Error? #98

Open
antifuchs opened this issue Apr 14, 2024 · 0 comments
Open

How do you use Query::Error? #98

antifuchs opened this issue Apr 14, 2024 · 0 comments

Comments

@antifuchs
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant