archive_it_client/
error.rs1use std::io;
2use std::path::PathBuf;
3
4use reqwest::StatusCode;
5
6#[derive(Debug, thiserror::Error)]
7pub enum Error {
8 #[error("sha1 mismatch for {url}: expected {expected}, got {actual}")]
9 ChecksumMismatch {
10 url: String,
11 expected: String,
12 actual: String,
13 },
14 #[error("authenticated account list was empty")]
15 Empty,
16 #[error("download path has no file name: {}", .path.display())]
17 InvalidDownloadPath { path: PathBuf },
18 #[error("invalid range response for {url}: {details}")]
19 InvalidRangeResponse { url: String, details: String },
20 #[error("I/O failed: {0}")]
21 Io(#[from] io::Error),
22 #[error("resource not found: {0}")]
23 NotFound(String),
24 #[error("no primary WARC location for {filename}")]
25 PrimaryLocationMissing { filename: String },
26 #[error("HTTP request failed: {0}")]
27 Request(#[from] reqwest::Error),
28 #[error("S3 operation failed: {0}")]
29 S3(Box<dyn std::error::Error + Send + Sync>),
30 #[error("downloaded {actual} bytes from {url}; expected {expected}")]
31 SizeMismatch {
32 url: String,
33 expected: u64,
34 actual: u64,
35 },
36 #[error("unexpected status: {0}")]
37 Status(StatusCode),
38 #[error("invalid URL: {0}")]
39 Url(#[from] url::ParseError),
40}