Skip to content

Commit

Permalink
add uncaughtException and unhandledRejection handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
pnedelko committed Aug 15, 2023
1 parent 9be2270 commit b8292ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions services/component-repository/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ const path = require('path');
require('dotenv').config({ path: path.join(__dirname, '.env') });
const App = require('./src/App.js');

process.on('uncaughtException', (err, origin) => console.error(err, origin));
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason);
// Application specific logging, throwing an error, or other logic here
});

(async () => {
try {
const app = new App();
Expand Down
2 changes: 1 addition & 1 deletion services/component-repository/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@
"sinon": "7.2.4",
"sinon-chai": "3.7.0"
},
"main": "src/index.js"
"main": "index.js"
}

0 comments on commit b8292ed

Please sign in to comment.