Merge branch 'api-err' into 'main'

publishEvent: throw errors

See merge request soapbox-pub/ditto!451
This commit is contained in:
Alex Gleason 2024-08-09 18:29:35 +00:00
commit 2cbbf2fbe7
2 changed files with 3 additions and 1 deletions

View file

@ -82,7 +82,7 @@ class EventsDB implements NStore {
} else if (e.message === 'Cannot replace an event with an older event') { } else if (e.message === 'Cannot replace an event with an older event') {
return; return;
} else { } else {
this.console.debug('ERROR', e.message); throw e;
} }
} }
} }

View file

@ -158,6 +158,8 @@ async function publishEvent(event: NostrEvent, c: AppContext): Promise<NostrEven
throw new HTTPException(422, { throw new HTTPException(422, {
res: c.json({ error: e.message }, 422), res: c.json({ error: e.message }, 422),
}); });
} else {
throw e;
} }
} }