Code Monkey home page Code Monkey logo

Comments (3)

lnicola avatar lnicola commented on August 16, 2024

Should the inner error be optional? Right now you get a compile error if you don't have one.

from snafu.

shepmaster avatar shepmaster commented on August 16, 2024

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.

lnicola avatar lnicola commented on August 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.