refactor: return 500 http code in case of error

This commit is contained in:
P. Reis 2025-02-26 20:21:42 -03:00
parent 0c7ab03643
commit 0f20f1b26b

View file

@ -160,11 +160,12 @@ const adminActionController: AppController = async (c) => {
}
if (data.type === 'revoke_name') {
n.revoke_name = true;
relay.remove?.([{ kinds: [30360], authors: [await conf.signer.getPublicKey()], '#p': [authorId] }]).catch(
(e: unknown) => {
try {
await relay.remove!([{ kinds: [30360], authors: [await conf.signer.getPublicKey()], '#p': [authorId] }]);
} catch (e) {
logi({ level: 'error', ns: 'ditto.api.admin.account.action', type: data.type, error: errorJson(e) });
},
);
return c.json({ error: 'Unexpected runtime error' }, 500);
}
}
await updateUser(authorId, n, c);