feat(NIP-20): improve invalid event error messages

Instead of returning a NOTICE for invalid events, return a `OK false`
command result with a reason as to why the event is invalid.
This commit is contained in:
William Casarin
2022-11-12 09:13:22 -06:00
committed by Greg Heartsfield
parent 5a91419d34
commit 6d1244434b
3 changed files with 32 additions and 19 deletions
+9 -3
View File
@@ -17,10 +17,16 @@ pub enum Error {
ConnWriteError,
#[error("EVENT parse failed")]
EventParseFailed,
#[error("ClOSE message parse failed")]
#[error("CLOSE message parse failed")]
CloseParseFailed,
#[error("Event validation failed")]
EventInvalid,
#[error("Event invalid signature")]
EventInvalidSignature,
#[error("Event invalid id")]
EventInvalidId,
#[error("Event malformed pubkey")]
EventMalformedPubkey,
#[error("Event could not canonicalize")]
EventCouldNotCanonicalize,
#[error("Event too large")]
EventMaxLengthError(usize),
#[error("Subscription identifier max length exceeded")]