diff --git a/apps/api/src/errors/api_error.rs b/apps/api/src/errors/api_error.rs index e972587..674d04c 100644 --- a/apps/api/src/errors/api_error.rs +++ b/apps/api/src/errors/api_error.rs @@ -1,14 +1,17 @@ use axum::response::IntoResponse; use sea_orm::DbErr; +use tracing::error; use crate::errors::service_error::ServiceError; +#[derive(Debug)] pub enum ApiError { ServiceError(ServiceError), } impl From for ApiError { fn from(err: ServiceError) -> Self { + error!("Service error occurred: {:?}", err); ApiError::ServiceError(err) } } @@ -21,6 +24,7 @@ impl From for ApiError { impl IntoResponse for ApiError { fn into_response(self) -> axum::response::Response { + error!("API error occurred: {:?}", self); match self { ApiError::ServiceError(service_error) => service_error.into_response(), } diff --git a/apps/api/src/services/agent_client.rs b/apps/api/src/services/agent_client.rs index 09c01aa..efb5ee4 100644 --- a/apps/api/src/services/agent_client.rs +++ b/apps/api/src/services/agent_client.rs @@ -8,7 +8,7 @@ use agent_client::{ }, models::{ValidateAndReloadBody, ValidateBody, WriteConfigBody}, }; -use tracing::warn; +use tracing::{error, warn}; use crate::{configs::agent::AgentSettings, errors::service_error::ServiceError}; @@ -23,6 +23,7 @@ pub enum AgentError { impl From for ServiceError { fn from(err: AgentError) -> Self { + error!("Agent error occurred: {:?}", err); match err { AgentError::ValidationFailed(_internal, user) => ServiceError::InternalError(user), AgentError::ApplicationFailed(_internal, user) => ServiceError::InternalError(user),