From 420c38cd9150ed5330e94d81fe8fcf2c12591495 Mon Sep 17 00:00:00 2001 From: jouzo <15011228+Jouzo@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:56:46 +0100 Subject: [PATCH] Debug ocean endpoint error --- lib/ain-macros/src/lib.rs | 1 + lib/ain-ocean/src/error.rs | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ain-macros/src/lib.rs b/lib/ain-macros/src/lib.rs index 249077cb24..d28c0d2733 100644 --- a/lib/ain-macros/src/lib.rs +++ b/lib/ain-macros/src/lib.rs @@ -100,6 +100,7 @@ pub fn ocean_endpoint(_attr: TokenStream, item: TokenStream) -> TokenStream { match #name(#(#param_names),*).await { Err(e) => { + log::debug!("[ocean_endpoint] error : {e:#?}"); let (status, message) = e.into_code_and_message(); Err(ApiError::new( status, diff --git a/lib/ain-ocean/src/error.rs b/lib/ain-ocean/src/error.rs index ff1663ecb6..20f5c0feba 100644 --- a/lib/ain-ocean/src/error.rs +++ b/lib/ain-ocean/src/error.rs @@ -242,14 +242,14 @@ impl From<&str> for Error { } } -#[derive(Serialize)] +#[derive(Serialize, Debug)] pub enum ErrorKind { NotFound, BadRequest, Unknown, } -#[derive(Serialize)] +#[derive(Serialize, Debug)] struct ApiErrorData { code: u16, r#type: ErrorKind, @@ -257,7 +257,7 @@ struct ApiErrorData { message: String, url: String, } -#[derive(Serialize)] +#[derive(Serialize, Debug)] pub struct ApiError { error: ApiErrorData, #[serde(skip)]