From 0c87d1866b05f62e882df9a6bf9d215ff5b5aaa2 Mon Sep 17 00:00:00 2001 From: Conrad Ludgate Date: Thu, 30 Nov 2023 13:43:21 +0000 Subject: [PATCH] proxy: fix wake_compute error prop (#5989) ## Problem fixes #5654 - WakeComputeErrors occuring during a connect_to_compute got propagated as IO errors, which get forwarded to the user as "Couldn't connect to compute node" with no helpful message. ## Summary of changes Handle WakeComputeError during ConnectionError properly --- proxy/src/compute.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/proxy/src/compute.rs b/proxy/src/compute.rs index 0741ad0623..c838c8fc38 100644 --- a/proxy/src/compute.rs +++ b/proxy/src/compute.rs @@ -1,9 +1,6 @@ use crate::{ - auth::parse_endpoint_param, - cancellation::CancelClosure, - console::errors::WakeComputeError, - error::{io_error, UserFacingError}, - proxy::is_neon_param, + auth::parse_endpoint_param, cancellation::CancelClosure, console::errors::WakeComputeError, + error::UserFacingError, proxy::is_neon_param, }; use futures::{FutureExt, TryFutureExt}; use itertools::Itertools; @@ -28,12 +25,9 @@ pub enum ConnectionError { #[error("{COULD_NOT_CONNECT}: {0}")] TlsError(#[from] native_tls::Error), -} -impl From for ConnectionError { - fn from(value: WakeComputeError) -> Self { - io_error(value).into() - } + #[error("{COULD_NOT_CONNECT}: {0}")] + WakeComputeError(#[from] WakeComputeError), } impl UserFacingError for ConnectionError { @@ -46,6 +40,7 @@ impl UserFacingError for ConnectionError { Some(err) => err.message().to_owned(), None => err.to_string(), }, + WakeComputeError(err) => err.to_string_client(), _ => COULD_NOT_CONNECT.to_owned(), } }