mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 22:22:51 +09:00
Better error handling
This commit is contained in:
parent
558213490a
commit
7dd4180fba
@ -13,7 +13,15 @@ export default (endpoint: IEndpoint, ctx: Koa.BaseContext) => new Promise((res)
|
|||||||
ctx.status = 204;
|
ctx.status = 204;
|
||||||
} else if (typeof x === 'number') {
|
} else if (typeof x === 'number') {
|
||||||
ctx.status = x;
|
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 {
|
} else {
|
||||||
ctx.body = x;
|
ctx.body = x;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user