Catch signature errors

This commit is contained in:
Jonathan Staab 2023-04-05 09:11:10 -05:00
parent 1a401ff20f
commit 6722131c8f
2 changed files with 13 additions and 2 deletions

View File

@ -174,7 +174,12 @@ class PublishableEvent {
this.event = {kind, content, tags, pubkey, created_at: createdAt}
}
getSignedEvent() {
return keys.sign(this.event)
try {
return keys.sign(this.event)
} catch (e) {
console.log(this.event)
throw e
}
}
async publish(relays, onProgress = null, verb = "EVENT") {
const event = await this.getSignedEvent()

View File

@ -287,7 +287,13 @@ async function subscribe({relays, filter, onEvent, onEose}: SubscribeOpts) {
seen.add(e.id)
if (!verifySignature(e)) {
try {
if (!verifySignature(e)) {
return
}
} catch (e) {
console.error(e)
return
}