at protocol indexer with flexible filtering, xrpc queries, and a cursor-backed event stream, built on fjall
at-protocol atproto indexer rust fjall

[backfill] refactor BackfillError to use thiserror

ptr.pet 12afce18 8c239314

verified
+6 -12
+6 -12
src/backfill/mod.rs
··· 12 use jacquard_common::xrpc::XrpcError; 13 use jacquard_repo::mst::Mst; 14 use jacquard_repo::{BlockStore, MemoryBlockStore}; 15 - use miette::{IntoDiagnostic, Result}; 16 use reqwest::StatusCode; 17 use smol_str::{SmolStr, ToSmolStr}; 18 use std::collections::HashMap; 19 - use std::fmt::Display; 20 use std::sync::Arc; 21 use std::sync::atomic::Ordering; 22 use std::time::{Duration, Instant}; 23 use tokio::sync::Semaphore; 24 use tracing::{debug, error, info, trace, warn}; 25 ··· 293 Ok(()) 294 } 295 296 enum BackfillError { 297 Generic(miette::Report), 298 Ratelimited, 299 Transport(SmolStr), 300 } 301 ··· 318 impl From<miette::Report> for BackfillError { 319 fn from(e: miette::Report) -> Self { 320 Self::Generic(e) 321 - } 322 - } 323 - 324 - impl Display for BackfillError { 325 - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 326 - match self { 327 - BackfillError::Generic(e) => e.fmt(f), 328 - BackfillError::Ratelimited => write!(f, "too many requests"), 329 - BackfillError::Transport(reason) => write!(f, "transport error: {reason}"), 330 - } 331 } 332 } 333
··· 12 use jacquard_common::xrpc::XrpcError; 13 use jacquard_repo::mst::Mst; 14 use jacquard_repo::{BlockStore, MemoryBlockStore}; 15 + use miette::{Diagnostic, IntoDiagnostic, Result}; 16 use reqwest::StatusCode; 17 use smol_str::{SmolStr, ToSmolStr}; 18 use std::collections::HashMap; 19 use std::sync::Arc; 20 use std::sync::atomic::Ordering; 21 use std::time::{Duration, Instant}; 22 + use thiserror::Error; 23 use tokio::sync::Semaphore; 24 use tracing::{debug, error, info, trace, warn}; 25 ··· 293 Ok(()) 294 } 295 296 + #[derive(Debug, Diagnostic, Error)] 297 enum BackfillError { 298 + #[error("{0}")] 299 Generic(miette::Report), 300 + #[error("too many requests")] 301 Ratelimited, 302 + #[error("transport error: {0}")] 303 Transport(SmolStr), 304 } 305 ··· 322 impl From<miette::Report> for BackfillError { 323 fn from(e: miette::Report) -> Self { 324 Self::Generic(e) 325 } 326 } 327