Skip to content

Commit

Permalink
Debug ocean endpoint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jouzo committed Sep 27, 2024
1 parent 939cd54 commit 420c38c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions lib/ain-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions lib/ain-ocean/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,22 +242,22 @@ 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,
at: u128,
message: String,
url: String,
}
#[derive(Serialize)]
#[derive(Serialize, Debug)]
pub struct ApiError {
error: ApiErrorData,
#[serde(skip)]
Expand Down

0 comments on commit 420c38c

Please sign in to comment.