Undisclosed project number 1234
1use reqwest::StatusCode;
2use superjam_core::{XrpcErrorCode, XrpcErrorMessage};
3use thiserror::Error;
4
5use crate::newtype::WriteOpCount;
6
7#[derive(Debug, Error)]
8#[non_exhaustive]
9pub enum Error {
10 #[error("network: {0}")]
11 Http(#[from] reqwest::Error),
12
13 #[error("oauth: {0}")]
14 OAuth(#[from] superjam_oauth::Error),
15
16 #[error("url: {0}")]
17 Url(#[from] url::ParseError),
18
19 #[error("serde: {0}")]
20 Serde(#[from] serde_json::Error),
21
22 #[error("xrpc {code}: {message}")]
23 Xrpc {
24 code: XrpcErrorCode,
25 message: XrpcErrorMessage,
26 },
27
28 #[error("xrpc status {status}, unparseable body: {body}")]
29 XrpcUnparsed { status: StatusCode, body: String },
30
31 #[error("apply_writes limit exceeded: got {got}, max {max}")]
32 ApplyWritesLimit {
33 got: WriteOpCount,
34 max: WriteOpCount,
35 },
36
37 #[error("apply_writes requires at least one operation")]
38 ApplyWritesEmpty,
39
40 #[error("lexicon validation rejected record: {0}")]
41 LexiconValidation(String),
42
43 #[error("DPoP nonce challenge persisted across retries")]
44 DpopNonceLoop,
45
46 #[error("server returned use_dpop_nonce with no DPoP-Nonce header")]
47 DpopNonceMissing,
48
49 #[error("refresh lock io: {0}")]
50 RefreshLock(#[source] std::io::Error),
51
52 #[error("session store: {0}")]
53 SessionStore(#[from] jacquard_common::session::SessionStoreError),
54}
55
56pub type Result<T> = core::result::Result<T, Error>;