From e35a4119e70f413dd43322b54f1f0367fc001941 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Tue, 20 Sep 2022 01:37:15 +0000 Subject: [PATCH] context is really handy --- web3_proxy/src/frontend/users.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web3_proxy/src/frontend/users.rs b/web3_proxy/src/frontend/users.rs index e1c1a17e..83b0e212 100644 --- a/web3_proxy/src/frontend/users.rs +++ b/web3_proxy/src/frontend/users.rs @@ -61,8 +61,11 @@ pub async fn get_login( let expiration_time = issued_at.add(Duration::new(expire_seconds as i64, 0)); - // TODO: proper errors. the first unwrap should be impossible, but the second will happen with bad input - let user_address: Address = params.remove("user_address").unwrap().parse().unwrap(); + let user_address: Address = params + .remove("user_address") + .context("impossible")? + .parse() + .context("bad input")?; // TODO: get most of these from the app config let message = Message {