Skip to content

Commit 1519a7e

Browse files
author
Dan McGhan
committed
Updated error handling in parts 1 and 2
1 parent 5979ac8 commit 1519a7e

File tree

2 files changed

+6
-4
lines changed
  • javascript/rest-api

2 files changed

+6
-4
lines changed

javascript/rest-api/part-1-web-server-basics/hr_app/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ async function shutdown(e) {
3434
console.log('Exiting process');
3535

3636
if (err) {
37-
process.exit(1);
37+
process.exit(1); // Non-zero failure code
3838
} else {
3939
process.exit(0);
4040
}
@@ -53,7 +53,8 @@ process.on('SIGINT', () => {
5353
});
5454

5555
process.on('uncaughtException', err => {
56-
console.log('Uncaught exception', err);
56+
console.log('Uncaught exception');
57+
console.error(err);
5758

5859
shutdown(err);
5960
});

javascript/rest-api/part-2-database-basics/hr_app/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ async function shutdown(e) {
6060
console.log('Exiting process');
6161

6262
if (err) {
63-
process.exit(1);
63+
process.exit(1); // Non-zero failure code
6464
} else {
6565
process.exit(0);
6666
}
@@ -79,7 +79,8 @@ process.on('SIGINT', () => {
7979
});
8080

8181
process.on('uncaughtException', err => {
82-
console.log('Uncaught exception', err);
82+
console.log('Uncaught exception');
83+
console.error(err);
8384

8485
shutdown(err);
8586
});

0 commit comments

Comments
 (0)