From 5f066ada307881e08e61ee9a94a9fc65440bc64f Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sun, 18 Apr 2021 20:04:07 +0300 Subject: Verbose JWT error message in transactions --- src/handlers.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/handlers.rs') diff --git a/src/handlers.rs b/src/handlers.rs index ddcc8a3..ead6828 100644 --- a/src/handlers.rs +++ b/src/handlers.rs @@ -527,7 +527,7 @@ pub async fn propose_transaction( token: String, db: Db, ) -> Result { - debug!("POST /transaction, authorized_propose_transaction() is handling"); + debug!("POST /transaction, propose_transaction() is handling"); let users_store = db.users.read(); @@ -659,10 +659,11 @@ pub async fn propose_transaction( let hashed_transaction = Md5::digest((&serde_json::to_string(&new_transaction).unwrap()).as_ref()); if token_payload.claims.tha != format!("{:x}", hashed_transaction) { + debug!("The hash of the transaction did not match with the hash given in JWT"); return Ok(warp::reply::with_status( warp::reply::json(&GradeCoinResponse { res: ResponseType::Error, - message: "The hash of the block did not match the hash given in JWT".to_owned(), + message: "The hash of the transaction did not match the hash given in JWT".to_owned(), }), StatusCode::BAD_REQUEST, )); -- cgit v1.2.3-70-g09d2