chore: clean-up critical error handling

This commit is contained in:
WebStreamr 2025-08-12 13:01:16 +00:00
parent c76ec91d15
commit 1a5cad40a2
No known key found for this signature in database

View file

@ -17,16 +17,6 @@ if (envIsProd()) {
console.log = console.warn = console.error = console.info = console.debug = () => { /* disable in favor of logger */ };
}
// At your apps entry point
process.on('uncaughtException', (err) => {
console.error('Uncaught exception caught:', err);
// Decide: exit gracefully or continue
});
process.on('unhandledRejection', (reason) => {
console.error('Unhandled rejection:', reason);
});
const logger = winston.createLogger({
transports: [
new winston.transports.Console({
@ -38,6 +28,14 @@ const logger = winston.createLogger({
],
});
process.on('uncaughtException', (error) => {
logger.error('Uncaught exception caught:', error);
});
process.on('unhandledRejection', (reason) => {
logger.error('Unhandled rejection: ', reason);
});
if (process.env['ALL_PROXY']) {
const proxyUrl = new URL(process.env['ALL_PROXY']);
if (proxyUrl.protocol === 'socks5:') {