chio_api_protect/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum ProtectError {
8 #[error("failed to load OpenAPI spec: {0}")]
9 SpecLoad(String),
10
11 #[error("failed to parse OpenAPI spec: {0}")]
12 SpecParse(#[from] chio_openapi::OpenApiError),
13
14 #[error("configuration error: {0}")]
15 Config(String),
16
17 #[error("upstream request failed: {0}")]
18 Upstream(String),
19
20 #[error("evaluation failed: {0}")]
21 Evaluation(String),
22
23 #[error(
24 "approval required (approval_id={approval_id:?}, kernel_receipt_id={kernel_receipt_id})"
25 )]
26 PendingApproval {
27 approval_id: Option<String>,
28 kernel_receipt_id: String,
29 },
30
31 #[error("receipt signing failed: {0}")]
32 ReceiptSign(String),
33
34 #[error("receipt persistence failed: {0}")]
35 ReceiptStore(String),
36
37 #[error("IO error: {0}")]
38 Io(#[from] std::io::Error),
39
40 #[error("HTTP client error: {0}")]
41 HttpClient(#[from] reqwest::Error),
42}