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

Add a troubleshooting section to the guide with common errors #212

Closed
shepmaster opened this issue Mar 11, 2020 · 3 comments · Fixed by #266
Closed

Add a troubleshooting section to the guide with common errors #212

shepmaster opened this issue Mar 11, 2020 · 3 comments · Fixed by #266
Labels
feedback requested User feedback desired on a design decision good first issue Good for newcomers help wanted Extra attention is needed

Comments

@shepmaster
Copy link
Owner

A common error is attempting to use MyErrorEnum::Variant when the context selector Variant should be used instead. It's worth documenting this.

Are there any other common issues?

@shepmaster shepmaster added help wanted Extra attention is needed good first issue Good for newcomers feedback requested User feedback desired on a design decision labels Mar 11, 2020
@shepmaster shepmaster pinned this issue Mar 11, 2020
@0xpr03
Copy link

0xpr03 commented Mar 13, 2020

Another problem I've got, from which this originated:
I was always using something like Err(MyError::ResponseLimit { ... }). That works well untill you try to emit a leaf error including a backtrace. Then you need ResponseLimit { ... }. But you can't do return Err(ResponseLimit { ... });, because that's not a MyError, it also won't work with return Err(MyError::ResponseLimit(ResponseLimit { ... })).
The fix is to use return ResponseLimit { ... }.fail(); and it works magically. I found that by accident browsing through the docs again.

@redragonx
Copy link

Another problem I found while learning SNAFU is that https://github.com/shepmaster/snafu/blob/2c2e6ea5617be02c06e0a8144a5e391de8cd067e/src/guide/attributes.md#controlling-visibility was nowhere to be found in the main docs.

Everything clicked after I found this guide.

@shepmaster
Copy link
Owner Author

Using .into() inside a context selector causes

cannot infer type for type parameter `__T0` declared on the struct ...

e.g.

Foo { message: "hello".into() }.fail()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feedback requested User feedback desired on a design decision good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants