diff --git a/catalyst-gateway/bin/src/event_db/mod.rs b/catalyst-gateway/bin/src/event_db/mod.rs index ecaea9764b..187c6f7690 100644 --- a/catalyst-gateway/bin/src/event_db/mod.rs +++ b/catalyst-gateway/bin/src/event_db/mod.rs @@ -35,15 +35,18 @@ pub(crate) struct EventDB { inspection_settings: Arc>, } -/// No DB URL was provided +/// `EventDB` Errors #[derive(thiserror::Error, Debug, PartialEq, Eq)] pub(crate) enum Error { + /// Database statement is not a valid modify statement #[error("Invalid Modify Statement")] InvalidModifyStatement, + /// Database statement is not a valid query statement #[error("Invalid Query Statement")] InvalidQueryStatement, + /// No DB URL was provided #[error("DB URL is undefined")] - NoDatabaseUrlError, + NoDatabaseUrl, } impl EventDB { @@ -230,7 +233,7 @@ pub(crate) async fn establish_connection(url: Option) -> anyhow::Result< let database_url = match url { Some(url) => url, // If the Database connection URL is not supplied, try and get from the env var. - None => std::env::var(DATABASE_URL_ENVVAR).map_err(|_| Error::NoDatabaseUrlError)?, + None => std::env::var(DATABASE_URL_ENVVAR).map_err(|_| Error::NoDatabaseUrl)?, }; let config = tokio_postgres::config::Config::from_str(&database_url)?; diff --git a/catalyst-gateway/bin/src/service/api/health/inspection_get.rs b/catalyst-gateway/bin/src/service/api/health/inspection_get.rs index 34f2e3623e..b0c6925d36 100644 --- a/catalyst-gateway/bin/src/service/api/health/inspection_get.rs +++ b/catalyst-gateway/bin/src/service/api/health/inspection_get.rs @@ -3,26 +3,25 @@ use std::sync::Arc; use poem::web::Data; -use poem_extensions::{response, UniResponse::T204}; +use poem_openapi::ApiResponse; use tracing::{debug, error}; use crate::{ logger::LogLevel, - service::common::responses::{ - resp_2xx::NoContent, - resp_4xx::ApiValidationError, - resp_5xx::{ServerError, ServiceUnavailable}, - }, + service::common::responses::WithErrorResponses, state::{DeepQueryInspection, State}, }; -/// All responses -pub(crate) type AllResponses = response! { - 204: NoContent, - 400: ApiValidationError, - 500: ServerError, - 503: ServiceUnavailable, -}; +/// Endpoint responses. +#[derive(ApiResponse)] +pub(crate) enum Responses { + /// Service is Started and can serve requests. + #[oai(status = 204)] + NoContent, +} + +/// All responses. +pub(crate) type AllResponses = WithErrorResponses; /// # GET /health/inspection /// @@ -61,5 +60,5 @@ pub(crate) async fn endpoint( ); } // otherwise everything seems to be A-OK - T204(NoContent) + Responses::NoContent.into() }