diff --git a/src/http/error.rs b/src/http/error.rs index ebb5d33..717aae1 100644 --- a/src/http/error.rs +++ b/src/http/error.rs @@ -51,11 +51,6 @@ impl IntoResponse for AppError { code: "file-error".to_string(), message: err.to_string(), }, - AppError::DockerError(err) => ErrorInfo { - status: StatusCode::INTERNAL_SERVER_ERROR, - code: "docker-error".to_string(), - message: err.to_string(), - }, AppError::Template(err) => ErrorInfo { status: StatusCode::INTERNAL_SERVER_ERROR, code: "template-error".to_string(), @@ -70,7 +65,21 @@ impl IntoResponse for AppError { code: code.to_string(), message: message.to_string(), }, - + AppError::DockerError(err) => match err { + bollard::errors::Error::DockerResponseServerError { + status_code, + message, + } => ErrorInfo { + status: StatusCode::from_u16(status_code).unwrap(), + code: "docker-error".to_string(), + message, + }, + _ => ErrorInfo { + status: StatusCode::INTERNAL_SERVER_ERROR, + code: "docker-error".to_string(), + message: err.to_string(), + }, + }, AppError::JSONFormat(rejection) => { let status = match rejection { JsonRejection::JsonDataError(_) => StatusCode::UNPROCESSABLE_ENTITY, diff --git a/templates/container/get-one.html b/templates/container/get-one.html index 79fbbf4..ace0dd1 100644 --- a/templates/container/get-one.html +++ b/templates/container/get-one.html @@ -11,7 +11,7 @@