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
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};
0
23
use tokio::sync::Semaphore;
24
use tracing::{debug, error, info, trace, warn};
25
···
293
Ok(())
294
}
295
0
296
enum BackfillError {
0
297
Generic(miette::Report),
0
298
Ratelimited,
0
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;
0
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)
0
0
0
0
0
0
0
0
0
0
325
}
326
}
327