1use rustenium_bidi_definitions::base::ErrorResponse;
2use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum SessionSendError {
6 #[error("Remote End Returned an Error Response: {0:?}")]
7 ErrorResponse(ErrorResponse),
8 #[error("Could not receive response for command in time")]
9 ResponseReceiveTimeoutError(ResponseReceiveTimeoutError)
10}
11#[derive(Debug, Error)]
12pub enum CommandResultError {
13 #[error("Invalid Result gotten For Command")]
14 InvalidResultTypeError(serde_json::Value),
15 #[error("Error Occurred with Command")]
16 SessionSendError(SessionSendError)
17}
18
19#[derive(Debug, Error)]
20pub struct ResponseReceiveTimeoutError;
21
22impl std::fmt::Display for ResponseReceiveTimeoutError {
23 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
24 write!(f, "Could not receive response for command in time")
25 }
26}
27
28#[derive(Debug, Error)]
29#[error("Failed to kill process")]
30pub struct ProcessKillError;
31
32#[derive(Debug, Error)]
33pub enum PostDataError {
34 #[error("No POST data available")]
35 NoPostData,
36 #[error("Failed to parse POST data as JSON: {0}")]
37 JsonParseError(#[from] serde_json::Error),
38 #[error("POST data is valid JSON but not a JSON object")]
39 NotJsonObject,
40}