axodotdev / cargo-dist

📦 shippable application packaging
https://axodotdev.github.io/cargo-dist/
Apache License 2.0
1.47k stars 66 forks source link

would b nice to have the rich errors we have for toml parsing for json parsing #1336

Closed ashleygwilliams closed 1 month ago

ashleygwilliams commented 1 month ago
ag_dubs@Ashleys-MBP-2 workers-sdk % cargo dist build
  × We encountered an issue trying to read your workspace
  ├─▶ failed to parse JSON
  ╰─▶ trailing comma at line 42 column 2
Gankra commented 1 month ago
    /// Found a workspace but it was malformed
    #[error("We encountered an issue trying to read your workspace")]
    ProjectBroken {
        /// The cause
        #[source]
        cause: AxoprojectError,
    },

We need to be way more vigilant about using diagnostic_source instead of source when wrapping our own errors. All the rich details are in miette-specific functionality that easily gets swallowed if you don't tell miette to forward it.