Files
Yumi/src/exception/NativeException.ts
T
2022-06-06 14:59:53 +07:00

20 lines
535 B
TypeScript

import Logger from '../libs/Logger';
class NativeException {
public process(): void {
process.on('uncaughtException', (exception) => {
Logger.log('critical', 'Critical error, cleaning up and exiting');
Logger.log('critical', exception.stack);
Logger.log('info', 'Clean up completed, exiting...');
process.exit(1);
});
process.on('unhandledRejection', (exception) => {
throw exception;
});
}
}
export default new NativeException();