From 9515611b82d0d12a2618d2a7599ad05d35516ffb Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Thu, 11 Jul 2024 15:47:17 +1200 Subject: [PATCH] Do not expose too much error detail over the network --- src/nostr.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/nostr.rs b/src/nostr.rs index 1632092..db6fa6c 100644 --- a/src/nostr.rs +++ b/src/nostr.rs @@ -90,9 +90,9 @@ impl WebSocketService { ) } ChorusError::Scraper => { - NostrReply::Closed(&subid, NostrReplyPrefix::Invalid, format!("{e}")) + NostrReply::Closed(&subid, NostrReplyPrefix::Invalid, format!("{}", e.inner)) } - _ => NostrReply::Closed(&subid, NostrReplyPrefix::Error, format!("{e}")), + _ => NostrReply::Closed(&subid, NostrReplyPrefix::Error, format!("{}", e.inner)), }; self.websocket.send(Message::text(reply.as_json())).await?; self.replied = true; @@ -241,14 +241,14 @@ impl WebSocketService { id, false, NostrReplyPrefix::Blocked, - "That event is deleted".to_string(), + "That event is deleted".to_string(), ), pocket_db::InnerError::Duplicate => { NostrReply::Ok(id, true, NostrReplyPrefix::Duplicate, "".to_string()) } - _ => NostrReply::Ok(id, false, NostrReplyPrefix::Error, format!("{}", e)), + _ => NostrReply::Ok(id, false, NostrReplyPrefix::Error, format!("{}", e.inner)), }, - _ => NostrReply::Ok(id, false, NostrReplyPrefix::Error, format!("{}", e)), + _ => NostrReply::Ok(id, false, NostrReplyPrefix::Error, format!("{}", e.inner)), }; self.websocket.send(Message::text(reply.as_json())).await?; self.replied = true; @@ -337,9 +337,9 @@ impl WebSocketService { if let Err(e) = self.auth_inner().await { let reply = match e.inner { ChorusError::AuthFailure(_) => { - NostrReply::Ok(id, false, NostrReplyPrefix::Invalid, format!("{e}")) + NostrReply::Ok(id, false, NostrReplyPrefix::Invalid, format!("{}", e.inner)) } - _ => NostrReply::Ok(id, false, NostrReplyPrefix::Error, format!("{e}")), + _ => NostrReply::Ok(id, false, NostrReplyPrefix::Error, format!("{}", e.inner)), }; self.websocket.send(Message::text(reply.as_json())).await?; self.replied = true;