mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
Better error handling
This commit is contained in:
parent
cc21302224
commit
3a33b82ed3
@ -13,7 +13,15 @@ export default (endpoint: IEndpoint, ctx: Koa.BaseContext) => new Promise((res)
|
||||
ctx.status = 204;
|
||||
} else if (typeof x === 'number') {
|
||||
ctx.status = x;
|
||||
ctx.body = { error: y };
|
||||
ctx.body = {
|
||||
error: {
|
||||
message: y.message,
|
||||
code: y.code,
|
||||
id: y.id,
|
||||
kind: y.kind,
|
||||
...(y.info ? { info: y.info } : {})
|
||||
}
|
||||
};
|
||||
} else {
|
||||
ctx.body = x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user