Skip to content

Commit

Permalink
improve error logging (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-t-wang authored Nov 20, 2024
1 parent ca9288d commit b3d344d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
15 changes: 12 additions & 3 deletions src/routes/api/v1/register_username.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,22 @@ pub async fn register_username(
{
Ok(()) => {},
Err(verify::Error::Verification(e)) => {
tracing::error!("Register Verification Error: {:?}", payload);
tracing::error!(
"Register Verification Error: {}, Payload: {:?}",
e.detail,
payload
);
return Err(ErrorResponse::validation_error(e.detail));
},
Err(_) => {
Err(e) => {
tracing::error!(
"Register Server Error: {}, Payload: {:?}",
e.to_string(),
payload
);
return Err(ErrorResponse::server_error(
"Failed to verify World ID proof".to_string(),
))
));
},
};

Expand Down
15 changes: 12 additions & 3 deletions src/routes/api/v1/rename.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,22 @@ pub async fn rename(
{
Ok(()) => {},
Err(verify::Error::Verification(e)) => {
tracing::error!("Rename Verification Error: {:?}", payload);
tracing::error!(
"Rename Verification Error: {}, Payload: {:?}",
e.detail,
payload
);
return Err(ErrorResponse::validation_error(e.detail));
},
Err(_) => {
Err(e) => {
tracing::error!(
"Rename Server Error: {}, Payload: {:?}",
e.to_string(),
payload
);
return Err(ErrorResponse::server_error(
"Failed to verify World ID proof".to_string(),
))
));
},
};

Expand Down
15 changes: 12 additions & 3 deletions src/routes/api/v1/update_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,22 @@ pub async fn update_record(
{
Ok(()) => {},
Err(verify::Error::Verification(e)) => {
tracing::error!("Update Record Verification Error: {:?}", payload);
tracing::error!(
"Update Record Verification Error: {}, Payload: {:?}",
e.detail,
payload
);
return Err(ErrorResponse::validation_error(e.detail));
},
Err(_) => {
Err(e) => {
tracing::error!(
"Update Record Server Error: {}, Payload: {:?}",
e.to_string(),
payload
);
return Err(ErrorResponse::server_error(
"Failed to verify World ID proof".to_string(),
))
));
},
};

Expand Down

0 comments on commit b3d344d

Please sign in to comment.