Comments (3)
Should the inner error be optional? Right now you get a compile error if you don't have one.
from snafu.
Should the inner error be optional
I’m not sure I’m following. If you don’t include a source
field, then there will be no inner error.
Do you mean optional as in source: Option<SomeError>
? If so, could you expand a bit about why you’d want that and what the use case is?
from snafu.
In your words :-):
If the original variant had a source field, its context selector will have an implementation of From for a Context
I didn't notice that, and this error got me a little confused, because it's not exactly clear what the issue is:
error[E0277]: the trait bound `Error: std::convert::From<snafu::Context<std::io::Error, Rename<&std::path::Path>>>` is not satisfied
--> src/main.rs:113:13
|
113 | fs::rename(path, cleaned).context(Rename { path })?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<snafu::Context<std::io::Error, Rename<&std::path::Path>>>` is not implemented for `Error`
|
= help: the following implementations were found:
<Error as std::convert::From<snafu::Context<snafu::NoneError, PathDecode<__T0, __T1>>>>
<Error as std::convert::From<snafu::Context<snafu::NoneError, Rename<__T0>>>>
<Error as std::convert::From<snafu::Context<snafu::NoneError, UnsupportedEncoding<__T0>>>>
<Error as std::convert::From<snafu::Context<uchardet::errors::Error, UnknownEncoding<__T0>>>>
<Error as std::convert::From<snafu::Context<walkdir::Error, Enumerate>>>
= note: required by `std::convert::From::from`
I'm not saying you should make that code work, it's just a thing I ran into.
from snafu.
Related Issues (20)
- Is it possible to automatically include fields in error's display? HOT 2
- Consider adding #[snafu(transparent)] HOT 6
- Support Serde for the built-in types HOT 6
- multiple error types (struct and enum) and generic `IntoError` HOT 2
- Simple context usage, mysterious compile error HOT 2
- Use the same deprecation macros on the no_std Error as the official Error HOT 3
- Add an ensure macro that works with pattern matching HOT 2
- Restore support for yeeting context selectors HOT 1
- Print multi-line errors on their own lines in `Report` HOT 2
- Const generics seem to be giving the derive macro trouble HOT 2
- question: Best practice for automatic error conversion over two module levels?
- Cannot use a generic with a whatever variant
- Incorrect year in changelog
- No apparent way to have an error enum variant documentation generated from a display string HOT 5
- Why isn't Whatever Send + Sync by default? HOT 5
- `Report` print doesn't prefix with "Error: " HOT 1
- Is it possible to avoid manually capturing a backtrace when variant has no `source` error? HOT 2
- Document using `Option<Backtrace>` more prominently in docs
- Comparison to anyhow HOT 2
- Use the alternate formatting macros from `color_print`. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snafu.