Skip to content

Commit 1e4957a

Browse files
committed
Split out WebSocket errors
1 parent 6dff52b commit 1e4957a

File tree

2 files changed

+23
-32
lines changed

2 files changed

+23
-32
lines changed

ui/src/server_axum.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ const MAX_AGE_ONE_YEAR: HeaderValue = HeaderValue::from_static("public, max-age=
6060
const DOCKER_PROCESS_TIMEOUT_SOFT: Duration = Duration::from_secs(10);
6161

6262
mod websocket;
63-
pub use websocket::CoordinatorManagerError as WebsocketCoordinatorManagerError;
64-
pub(crate) use websocket::ExecuteError as WebsocketExecuteError;
6563

6664
#[derive(Debug, Clone)]
6765
struct CoordinatorOneOffFactory(Arc<CoordinatorFactory>);
@@ -997,9 +995,6 @@ enum Error {
997995
#[snafu(display("{PLAYGROUND_GITHUB_TOKEN} not set up for reading/writing gists"))]
998996
NoGithubToken,
999997

1000-
#[snafu(display("Unable to deserialize request"))]
1001-
Deserialization { source: serde_json::Error },
1002-
1003998
#[snafu(transparent)]
1004999
EvaluateRequest {
10051000
source: api_orchestrator_integration_impls::ParseEvaluateRequestError,
@@ -1035,9 +1030,6 @@ enum Error {
10351030
source: api_orchestrator_integration_impls::ParseMacroExpansionRequestError,
10361031
},
10371032

1038-
#[snafu(display("The WebSocket worker panicked: {}", text))]
1039-
WebSocketTaskPanic { text: String },
1040-
10411033
#[snafu(display("Unable to find the available crates"))]
10421034
Crates {
10431035
source: orchestrator::coordinator::CratesError,
@@ -1093,24 +1085,6 @@ enum Error {
10931085

10941086
#[snafu(display("The operation timed out"))]
10951087
Timeout { source: tokio::time::error::Elapsed },
1096-
1097-
#[snafu(display("Unable to spawn a coordinator task"))]
1098-
StreamingCoordinatorSpawn {
1099-
source: WebsocketCoordinatorManagerError,
1100-
},
1101-
1102-
#[snafu(display("Unable to idle the coordinator"))]
1103-
StreamingCoordinatorIdle {
1104-
source: WebsocketCoordinatorManagerError,
1105-
},
1106-
1107-
#[snafu(display("Unable to perform a streaming execute"))]
1108-
StreamingExecute { source: WebsocketExecuteError },
1109-
1110-
#[snafu(display("Unable to pass stdin to the active execution"))]
1111-
StreamingCoordinatorExecuteStdin {
1112-
source: tokio::sync::mpsc::error::SendError<()>,
1113-
},
11141088
}
11151089

11161090
type Result<T, E = Error> = ::std::result::Result<T, E>;

ui/src/server_axum/websocket.rs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ use tokio::{
3030
use tokio_util::sync::CancellationToken;
3131
use tracing::{error, instrument, warn, Instrument};
3232

33-
use super::{
34-
DeserializationSnafu, Error, Result, StreamingCoordinatorExecuteStdinSnafu,
35-
StreamingCoordinatorIdleSnafu, StreamingCoordinatorSpawnSnafu, StreamingExecuteSnafu,
36-
WebSocketTaskPanicSnafu,
37-
};
38-
3933
#[derive(Debug, serde::Deserialize, serde::Serialize)]
4034
#[serde(rename_all = "camelCase")]
4135
struct MetaInner {
@@ -797,3 +791,26 @@ pub(crate) enum ExecuteError {
797791
}
798792

799793
type ExecuteResult<T, E = ExecuteError> = std::result::Result<T, E>;
794+
795+
#[derive(Debug, Snafu)]
796+
enum Error {
797+
#[snafu(display("Unable to deserialize request"))]
798+
Deserialization { source: serde_json::Error },
799+
800+
#[snafu(display("The WebSocket worker panicked: {}", text))]
801+
WebSocketTaskPanic { text: String },
802+
803+
#[snafu(display("Unable to spawn a coordinator task"))]
804+
StreamingCoordinatorSpawn { source: CoordinatorManagerError },
805+
806+
#[snafu(display("Unable to idle the coordinator"))]
807+
StreamingCoordinatorIdle { source: CoordinatorManagerError },
808+
809+
#[snafu(display("Unable to perform a streaming execute"))]
810+
StreamingExecute { source: ExecuteError },
811+
812+
#[snafu(display("Unable to pass stdin to the active execution"))]
813+
StreamingCoordinatorExecuteStdin {
814+
source: tokio::sync::mpsc::error::SendError<()>,
815+
},
816+
}

0 commit comments

Comments
 (0)