Skip to content

refactor: replace eyre with miette, improve error handling#197

Merged
NTBBloodbath merged 23 commits into
masterfrom
push-xupolxxmyzky
Jul 14, 2026
Merged

refactor: replace eyre with miette, improve error handling#197
NTBBloodbath merged 23 commits into
masterfrom
push-xupolxxmyzky

Conversation

@NTBBloodbath

Copy link
Copy Markdown
Collaborator

No description provided.

- 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)
Cargo.toml and lockfile only. All code references removed in prior
migration to miette
@NTBBloodbath NTBBloodbath marked this pull request as ready for review July 13, 2026 21:11
@NTBBloodbath NTBBloodbath marked this pull request as draft July 13, 2026 21:22
…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
…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
@NTBBloodbath NTBBloodbath changed the title refactor: replace eyre with miette refactor: replace eyre with miette, improve error handling Jul 14, 2026
@NTBBloodbath NTBBloodbath marked this pull request as ready for review July 14, 2026 17:27
@NTBBloodbath NTBBloodbath merged commit b6efc0b into master Jul 14, 2026
4 checks passed
@NTBBloodbath NTBBloodbath deleted the push-xupolxxmyzky branch July 14, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant