sqlmap_rs/error.rs
1//! Error definitions for the sqlmapapi binding.
2
3use thiserror::Error;
4
5/// Core error type for sqlmap api interactions.
6#[derive(Debug, Error)]
7pub enum SqlmapError {
8 /// Failed to launch or track the `sqlmapapi.py` subprocess.
9 #[error("API process error: {0}")]
10 ProcessError(#[from] std::io::Error),
11
12 /// Missing or invalid dependencies (Python or sqlmapapi not found).
13 #[error("Binary not found: {0}. Ensure python3 and sqlmap are in PATH.")]
14 BinaryNotFound(String),
15
16 /// HTTP Request error when polling the REST API.
17 #[error("HTTP Request failed: {0}")]
18 RequestError(#[from] reqwest::Error),
19
20 /// The API responded with an error message (success: false).
21 #[error("Sqlmap API returned error: {0}")]
22 ApiError(String),
23
24 /// API did not respond with expected semantic JSON format.
25 #[error("Malformed JSON response structure.")]
26 MalformedResponse,
27
28 /// Polling timeout while waiting for task to complete.
29 #[error("Task execution timed out after {0} seconds.")]
30 Timeout(u64),
31
32 /// The provided task ID was unrecognized by the server.
33 #[error("Invalid Task ID: {0}")]
34 InvalidTask(String),
35}