victauri_test/error.rs
1/// Errors that can occur when interacting with the Victauri MCP server from tests.
2#[derive(Debug, thiserror::Error)]
3#[non_exhaustive]
4pub enum TestError {
5 /// Failed to connect to the Victauri MCP server at the expected port.
6 #[error("connection failed: {0}")]
7 Connection(String),
8
9 /// An HTTP-level error occurred during an MCP request.
10 #[error("MCP request failed: {0}")]
11 Request(#[from] reqwest::Error),
12
13 /// The MCP server returned a JSON-RPC error response.
14 #[error("MCP returned error: {message}")]
15 Mcp {
16 /// JSON-RPC error code.
17 code: i64,
18 /// Human-readable error message from the server.
19 message: String,
20 },
21
22 /// A tool call returned `isError: true` in its result.
23 #[error("tool call failed: {0}")]
24 ToolError(String),
25
26 /// A test assertion evaluated to false.
27 #[error("assertion failed: {0}")]
28 Assertion(String),
29
30 /// A `wait_for` condition did not become true within the allowed time.
31 #[error("timeout: {0}")]
32 Timeout(String),
33
34 /// An element matching the given criteria was not found in the DOM snapshot.
35 #[error("element not found: {0}")]
36 ElementNotFound(String),
37
38 /// A visual regression was detected — screenshot differs from baseline.
39 #[error("visual regression: {0}")]
40 VisualRegression(String),
41
42 /// A catch-all for errors that don't fit other variants (IO, encoding, etc.).
43 #[error("{0}")]
44 Other(String),
45}