refactor: replace eyre with miette, improve error handling#197
Merged
Conversation
- Add miette 7.6.0 with "fancy" feature to core/Cargo.toml
- Set up miette::Report as main() return type
- Add .into_diagnostic() for std error conversions in main()
- Replace tracing::error! with eprintln!("{:?}", ...) for
future miette fancy output compatibility
- Replace eyre::{Error, Result} with miette::Report in return type
- convert() now returns std::result::Result<T, miette::Report>
Bulk rename `eyre` → `miette` across 26 source files (imports, macros, `::Result`). Then fix compilation by adding `.into_diagnostic()` on every `?` for std errors (io::Error, git2::Error, toml::de::Error, hyper::http::Error). miette has no blanket `From<E: std::error::Error>`. Also fixed: - `.with_context()` → `.into_diagnostic().wrap_err_with()` - Removed redundant `.into_diagnostic()` after `.wrap_err()` / `.map_err(|e| miette!(...))` on miette::Result - Removed `.into_diagnostic()` from calls to internal functions already returning miette::Result - Dropped unused `Context` import (miette uses WrapErr)
692bd5e to
ad2eeb6
Compare
Cargo.toml and lockfile only. All code references removed in prior migration to miette
ad2eeb6 to
e552ee3
Compare
…ontext Install miette::set_hook so every error renders through the graphical handler (unicode box drawing, source spans, ANSI colors). Add .wrap_err() to all 143 bare .into_diagnostic() calls so every IO/git2/TOML error explains which operation failed
…rough miette Add #[derive(Diagnostic)] to ValidationError with per-variant help text. Remove redundant eprintln! before bail! in build and dev server config validation so errors render once through the miette graphical handler
Add context to 4 generic bail! calls: "Server error" -> "Development/Preview server error", "cargo build failed" -> "Plugin cargo build failed", "no plugin.toml found" -> include directory path
Add stderr capture to cargo build failure, include directory in library not found error, unify landlock messages, name the plugin in JSON parse errors, and add file path context to cache serialization errors
Convert expect/unwrap panics in metadata parsing, asset handling, and draft field validation to proper miette errors. Add warn! logs for silently swallowed sandbox and cache failures. Improve context for template rendering and asset reading errors. Standardize case on plugin error messages
7f04db1 to
83d1878
Compare
…onable hints - Drop redundant "Validation failed" prefix from each message - Add concrete fix example per field (e.g. set author = "Your Name") - Attach NamedSource to show config file path and content on validation errors - Refactor bail to return Err with miette source code in both build and dev paths
83d1878 to
acc1f36
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.