Files
mtgc/crates/mtgc-core/src/error.rs
garrettmills 342b8da797 Overhaul card-data ingest: filter art cards, segmented cancellable progress
- Exclude Scryfall Art Series cards (layout "art_series") from ingest —
  they aren't playable cards and were polluting search results.
- Replace the coarse per-stage progress text with a byte-accurate,
  weighted multi-segment progress bar (Index / Card data / Printings /
  Indexing) that fills as one continuous bar instead of swapping per
  stage; segment weights are computed from the real download sizes
  reported by Scryfall's bulk-data index (the download responses
  themselves are chunked with no Content-Length to rely on).
- Add a Cancel button, wired through a new CancelToken checked once per
  parsed record so cancellation lands almost instantly.
- Fix a related correctness bug this surfaced: ingest used to delete the
  existing reference.db before writing its replacement, so a cancelled
  or crashed update left the app with no card database at all. It now
  builds into a temp file and only atomically replaces reference.db on
  full success.
- Split the topbar's single "Choose library…" action into separate
  "Open Library…" (existing file) and "New Library…" (save-dialog for a
  new file) buttons.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-07 20:22:31 -05:00

33 lines
599 B
Rust

//! Core error type.
use thiserror::Error;
#[derive(Debug, Error)]
pub enum CoreError {
#[error(transparent)]
Sqlite(#[from] rusqlite::Error),
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("http error: {0}")]
Http(String),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("cancelled")]
Cancelled,
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, CoreError>;
impl From<ureq::Error> for CoreError {
fn from(e: ureq::Error) -> Self {
CoreError::Http(e.to_string())
}
}