nostr-rs-relay

My dev fork of nostr-rs-relay
git clone git://jb55.com/nostr-rs-relay
Log | Files | Refs | README | LICENSE

commit 9e06cc948231d56975df48cafc843bef79f1b01a
parent e66fa4ac42acb44ec074be7d1081ca726d83e0b4
Author: Greg Heartsfield <scsibug@imap.cc>
Date:   Sat, 12 Feb 2022 16:33:29 -0600

improvement: better error messages on parse failures

Diffstat:
Msrc/main.rs | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs @@ -502,7 +502,7 @@ async fn nostr_server( }, Err(_) => { info!("invalid command ignored"); - + ws_stream.send(Message::Text(format!("[\"NOTICE\",\"{}\"]", "could not parse command"))).await.ok(); } } }, @@ -514,6 +514,10 @@ async fn nostr_server( info!("client {:?} sent event larger ({} bytes) than max size", cid, s); ws_stream.send(Message::Text(format!("[\"NOTICE\",\"{}\"]", "event exceeded max size"))).await.ok(); }, + Err(Error::ProtoParseError) => { + info!("client {:?} sent event that could not be parsed", cid); + ws_stream.send(Message::Text(format!("[\"NOTICE\",\"{}\"]", "could not parse command"))).await.ok(); + }, Err(e) => { info!("got non-fatal error from client: {:?}, error: {:?}", cid, e); },