mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
v3: review some more files, add logging for unhandled promises
This commit is contained in:
@@ -20,4 +20,15 @@ if (IS_PROD) {
|
||||
});
|
||||
}
|
||||
|
||||
// Logs unhandled promises errors
|
||||
// when no catch is attached to a promise a unhandledRejection event will be triggered
|
||||
process.on('unhandledRejection', function handlePromiseRejection (reason, promise) {
|
||||
let stack = reason.stack || reason.message || reason;
|
||||
|
||||
logger.error(stack, {
|
||||
promise,
|
||||
fullError: reason,
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = logger;
|
||||
|
||||
Reference in New Issue
Block a user