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

Question: In src/errors.rs, why are ContextualErrorKind and ContextualError declared separately? #87

Closed
KSXGitHub opened this issue Apr 27, 2019 · 5 comments · Fixed by #88

Comments

@KSXGitHub
Copy link
Contributor

KSXGitHub commented Apr 27, 2019

In src/errors.rs, I see ContextualError being a wrapper of ContextualErrorKind, is there a reason of this?

@svenstaro
Copy link
Owner

@KSXGitHub
Copy link
Contributor Author

Given its high maintenance cost, and its convoluted usage (Err(ContextualError::new(ContextualErrorKind::<name>(...)))), I don't see the advantage of this pattern.

@svenstaro
Copy link
Owner

@boastful-squirrel did this part so maybe they can provide some insight here.

@ghost
Copy link

ghost commented Apr 27, 2019

That's from when I was using failure's context() method, see the link that @svenstaro posted. Now that I don't use the context() feature anymore, all methods could return a ContextualErrorKind and you could simply write ContextualErrorKind::<name> everywhere.

The reason I didn't remove the ContextualError type yet is because I keep playing with failure to see if there is a way to have the errors the way they are now using failure's context, but well, still not yet.

So if @svenstaro agrees, we could totally drop those calls everywhere. If so, should I include that in my current PR ? While I'm a it... Or another one ?

EDIT: you already did it, cool

@svenstaro
Copy link
Owner

svenstaro commented Apr 27, 2019 via email

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

Successfully merging a pull request may close this issue.

2 participants