Create NativeException.ts

This commit is contained in:
2021-09-14 09:57:06 -07:00
parent e28ae3ee68
commit be8524f5b7
+27
View File
@@ -0,0 +1,27 @@
import Logger from '../libs/Logger';
import App from '../providers/App';
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;