mockforge_bench/
error.rs

1//! Error types for the bench module
2
3use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, BenchError>;
6
7#[derive(Error, Debug)]
8pub enum BenchError {
9    #[error("Failed to parse OpenAPI spec: {0}")]
10    SpecParseError(String),
11
12    #[error("Invalid target URL: {0}")]
13    InvalidTargetUrl(String),
14
15    #[error("Operation not found in spec: {0}")]
16    OperationNotFound(String),
17
18    #[error("k6 is not installed or not found in PATH")]
19    K6NotFound,
20
21    #[error("k6 execution failed: {0}")]
22    K6ExecutionFailed(String),
23
24    #[error("Failed to generate k6 script: {0}")]
25    ScriptGenerationFailed(String),
26
27    #[error("Failed to parse k6 results: {0}")]
28    ResultsParseError(String),
29
30    #[error("Invalid scenario: {0}")]
31    InvalidScenario(String),
32
33    #[error("IO error: {0}")]
34    IoError(#[from] std::io::Error),
35
36    #[error("JSON error: {0}")]
37    JsonError(#[from] serde_json::Error),
38
39    #[error("Request error: {0}")]
40    RequestError(#[from] reqwest::Error),
41
42    #[error("Other error: {0}")]
43    Other(String),
44}