Browse Source

correct error handling in exitHandler #853 (#854)

pull/1/head
jonyrock-back 4 years ago committed by GitHub
parent
commit
09788eb0dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      server/src/services/process_service.ts

13
server/src/services/process_service.ts

@ -1,4 +1,4 @@
import * as config from '../config';
var exitHandlers: (() => void)[] = [];
var exitHandled = false;
@ -18,9 +18,16 @@ function exitHandler(options: any, err?: any) {
}
exitHandled = true;
for(let i = 0; i < exitHandlers.length; i++) {
exitHandlers[i]();
try {
exitHandlers[i]();
} catch(e) {
console.error('Got error during exit: ' + e);
if(!config.PRODUCTION_MODE && e instanceof Error) {
console.error(e.stack);
}
}
}
console.log('process exit');
console.log('process exited successfully');
process.exit();
}

Loading…
Cancel
Save