tangled
alpha
login
or
join now
ptr.pet
/
hydrant
26
fork
atom
at protocol indexer with flexible filtering, xrpc queries, and a cursor-backed event stream, built on fjall
at-protocol
atproto
indexer
rust
fjall
26
fork
atom
overview
issues
6
pulls
pipelines
[backfill] refactor BackfillError to use thiserror
ptr.pet
3 weeks ago
12afce18
8c239314
verified
This commit was signed with the committer's
known signature
.
ptr.pet
SSH Key Fingerprint:
SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw=
+6
-12
1 changed file
expand all
collapse all
unified
split
src
backfill
mod.rs
+6
-12
src/backfill/mod.rs
···
12
12
use jacquard_common::xrpc::XrpcError;
13
13
use jacquard_repo::mst::Mst;
14
14
use jacquard_repo::{BlockStore, MemoryBlockStore};
15
15
-
use miette::{IntoDiagnostic, Result};
15
15
+
use miette::{Diagnostic, IntoDiagnostic, Result};
16
16
use reqwest::StatusCode;
17
17
use smol_str::{SmolStr, ToSmolStr};
18
18
use std::collections::HashMap;
19
19
-
use std::fmt::Display;
20
19
use std::sync::Arc;
21
20
use std::sync::atomic::Ordering;
22
21
use std::time::{Duration, Instant};
22
22
+
use thiserror::Error;
23
23
use tokio::sync::Semaphore;
24
24
use tracing::{debug, error, info, trace, warn};
25
25
···
293
293
Ok(())
294
294
}
295
295
296
296
+
#[derive(Debug, Diagnostic, Error)]
296
297
enum BackfillError {
298
298
+
#[error("{0}")]
297
299
Generic(miette::Report),
300
300
+
#[error("too many requests")]
298
301
Ratelimited,
302
302
+
#[error("transport error: {0}")]
299
303
Transport(SmolStr),
300
304
}
301
305
···
318
322
impl From<miette::Report> for BackfillError {
319
323
fn from(e: miette::Report) -> Self {
320
324
Self::Generic(e)
321
321
-
}
322
322
-
}
323
323
-
324
324
-
impl Display for BackfillError {
325
325
-
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
326
326
-
match self {
327
327
-
BackfillError::Generic(e) => e.fmt(f),
328
328
-
BackfillError::Ratelimited => write!(f, "too many requests"),
329
329
-
BackfillError::Transport(reason) => write!(f, "transport error: {reason}"),
330
330
-
}
331
325
}
332
326
}
333
327