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;
|
||||
}
|
||||
|
||||
koa.on("error", async err => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
koa.use(
|
||||
koaJwt({
|
||||
secret: JWT_SECRET,
|
||||
@@ -179,6 +183,10 @@ function exit() {
|
||||
});
|
||||
}
|
||||
|
||||
process.on("unhandledRejection", err => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
process.on("uncaughtException", err => {
|
||||
logger.error({
|
||||
message: "Uncaught exception",
|
||||
|
||||
Reference in new issue
Block a user