-
Notifications
You must be signed in to change notification settings - Fork 0
Error Handling
Suraj kc edited this page Jun 30, 2020
·
1 revision
-
Operational error: It represents runtime errors which can be predicted and should be handled properly. It does not mean application has bugs. Some examples include:
out of memory, missing parameters in API endpoint` etc. -
Programmer error: It represents unexpected bug in the program. It implies the application itself has bugs. An example would be trying to access property of an object which does not exists. When such error occur, it is ideal to restart the application.
Ref: https://www.toptal.com/nodejs/node-js-error-handling
Testing Programmer error
app.get('/crash', function() {
process.nextTick(function () {
throw new Error;
});
})This error would trigger the following:
process.on('uncaughtException', (error: Error) => {
// Handle error
});