This post provides a guide/tutorial from what I learn’t from one of my projects on how to wrap errors with enums when using the error stack crate in rust.

  • SorteKanin@feddit.dk
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    I guess what I don’t really understand still is what advantage this provides over something like anyhow.

    • snaggen@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Error stack will give will print the full stack of errors and their corresponding line in the code. Much like a backtrace, but for errors.

      • SorteKanin@feddit.dk
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Doesn’t anyhow also give a stack of errors? Although not with lines, that does sound useful.

        • snaggen@programming.dev
          link
          fedilink
          English
          arrow-up
          1
          ·
          1 year ago

          You are right, it does. But as you say, it seems more limited in that aspect than error-stack from a first glance.