tiny cleanup

This commit is contained in:
ennmichael 2023-03-02 21:23:00 +01:00
parent 6daa75b21c
commit a34e6960d2
No known key found for this signature in database
GPG Key ID: 6E6E183431A26AF7

View File

@ -9,7 +9,6 @@ import { EventEmitter } from "./emitter"
* A nostr client.
*
* TODO Document the events here
* TODO Move all this to that file and add the newListener and removeListener events there as well
*/
export class Nostr extends EventEmitter {
// TODO NIP-44 AUTH, leave this for later
@ -66,12 +65,7 @@ export class Nostr extends EventEmitter {
} else if (msg.kind === IncomingKind.Notice) {
this.emit("notice", msg.notice, this)
} else {
const err = new ProtocolError(`invalid message ${msg}`)
try {
this.emit("error", err, this)
} catch (err) {
// Don't propagate errors from the error callback.
}
throw new ProtocolError(`invalid message ${msg}`)
}
} catch (err) {
this.emit("error", err, this)