misp_client/
error.rs

1//! Error types for MISP API operations.
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum MispError {
7    #[error("HTTP request failed: {0}")]
8    Request(#[from] reqwest::Error),
9
10    #[error("Authentication failed: {0}")]
11    Authentication(String),
12
13    #[error("API returned error: {status} {message}")]
14    Api { status: u16, message: String },
15
16    #[error("Failed to parse response: {0}")]
17    Parse(#[from] serde_json::Error),
18
19    #[error("Event not found: {0}")]
20    EventNotFound(String),
21
22    #[error("Attribute not found: {0}")]
23    AttributeNotFound(String),
24
25    #[error("Invalid response structure: {0}")]
26    InvalidResponse(String),
27}