rullst_core/client_contract/
error.rs1use thiserror::Error;
2
3#[derive(Debug, Error)]
5#[non_exhaustive]
6pub enum ClientContractError {
7 #[error("client contract version must be positive")]
9 InvalidVersion,
10 #[error("client request id must be a 1-128 byte ASCII token")]
12 InvalidRequestId,
13 #[error("client idempotency key must be an 8-128 byte ASCII token")]
15 InvalidIdempotencyKey,
16 #[error("client failure code must be a bounded lowercase dotted identifier")]
18 InvalidFailureCode,
19 #[error("client version offer must not be empty")]
21 EmptyVersionOffer,
22 #[error("client version offer exceeds 16 entries")]
24 TooManyOfferedVersions,
25 #[error("client contract policy range or body limit is invalid")]
27 InvalidPolicy,
28 #[error("client and server have no mutually supported contract version")]
30 NoMutualVersion,
31 #[error(
33 "client contract version {received} is outside the supported range {minimum}..={current}"
34 )]
35 UnsupportedVersion {
36 received: u16,
38 minimum: u16,
40 current: u16,
42 },
43 #[error("client mutation requires an idempotency key")]
45 MissingIdempotencyKey,
46 #[error("client contract body exceeds the {maximum}-byte maximum")]
48 BodyTooLarge {
49 maximum: usize,
51 },
52 #[error("client contract JSON is invalid")]
54 InvalidJson(#[source] serde_json::Error),
55 #[error("client contract JSON encoding failed")]
57 EncodeJson(#[source] serde_json::Error),
58}