Add API error handling mechanism (#14)
This commit is contained in:
1 parent
ad3dfeae7f
commit
f48b596271
1 file changed
+8
@@ -52,6 +52,10 @@ function getPermissionSets(roles) {
|
|||||||
return permissionSets;
|
return permissionSets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
koa.on("error", async err => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
koa.use(
|
koa.use(
|
||||||
koaJwt({
|
koaJwt({
|
||||||
secret: JWT_SECRET,
|
secret: JWT_SECRET,
|
||||||
@@ -179,6 +183,10 @@ function exit() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process.on("unhandledRejection", err => {
|
||||||
|
throw err;
|
||||||
|
});
|
||||||
|
|
||||||
process.on("uncaughtException", err => {
|
process.on("uncaughtException", err => {
|
||||||
logger.error({
|
logger.error({
|
||||||
message: "Uncaught exception",
|
message: "Uncaught exception",
|
||||||
|
|||||||
Reference in new issue
Block a user