Fancy error reporting with miette

Поділитися
Вставка
  • Опубліковано 27 гру 2024
  • Learn Rust at www.rustadvent...
    Fancy error reporting with miette and thiserror.
    GitHub Repo: github.com/rus...
    First color CLI video: • Generating colors with...
    Twitter: / rustadventure
    Twitter: / chrisbiscardi

КОМЕНТАРІ • 11

  • @felixst-gelais6722
    @felixst-gelais6722 2 роки тому +15

    fun fact: "miette" means "crumb" in french! so the lib is comparing error reporting with "following bread crumbs", which i think is pretty neat

  • @Siniverisyys
    @Siniverisyys Рік тому

    I felt like that I didn't have the time or energy to take on miette's fancy error handling, but you explained it so well it seems pretty easy now. Really looking forward to the `wrap_err` feature too. Probably not just helpful to the user - helpful to the developer too ;-)

  • @whoisryosuke
    @whoisryosuke 2 роки тому +1

    Great way to add structured error output to a project. I like how clean everything looks implemented.
    Maybe a little confusing with miette using `Result`? Maybe `MResult` might be better for them to avoid confusion... 🤔

    • @chrisbiscardi
      @chrisbiscardi  2 роки тому +4

      type aliasing Result to specialize it to the type in the library crate it's being used in is a fairly common approach. serde_json has a Result, reqwest has one too, and even the standard library uses on in std::io::Result.
      You can always swap `use miette::Result` instead with a miette::Result in the type signature to be more clear if you want to.

  • @Yotanido
    @Yotanido 2 роки тому

    For fancy parse errors, Ariadne is also very nice

    • @chrisbiscardi
      @chrisbiscardi  2 роки тому

      ariadne is listed as inspiration in miette's readme too!

  • @azzamsya
    @azzamsya 2 роки тому

    Thank you so much for this tutorial!

  • @katopz
    @katopz 2 роки тому

    How can I have smooth line pointer and underline error print out like that?
    All I have here is an ascii ^^^^^^^^^^^^^^^^^^^^^^^ like this when error. 🤔

    • @iippari7
      @iippari7 2 роки тому +1

      Did you remember to enable the `fancy` feature? I've never used miette, but that sounds like it could be what's going wrong.

    • @underhilloverhill
      @underhilloverhill 2 роки тому +2

      could be the terminal/font config

    • @magnusmarkling
      @magnusmarkling 2 роки тому +1

      I get the smooth underline when running a simple example (with "fancy" enabled) in both Terminal and iTerm2 apps on MacOS. Nothing else required.