If you don't listen for this hook, errors will be thrown using the throw keyword, which will cause the bot to crash and the program to quit. However, you can listen to the error hook to handle errors gracefully and avoid this from occuring.
error is a string of some sortbot.on('error', (error) => {
console.error(`An error occurred: ${error}`);
});
Do NOT simply put an empty callback here! This will cause the bot to silently ignore errors, which is very bad for debugging and overall stability. Always at least log the error to console, or ideally handle it in some way.
If you don't listen for this hook, errors will be thrown using the throw keyword, which will cause the bot to crash and the program to quit. However, you can listen to the error hook to handle errors gracefully and avoid this from occuring.
error is a string of some sortbot.on('error', (error) => {
console.error(`An error occurred: ${error}`);
});
Do NOT simply put an empty callback here! This will cause the bot to silently ignore errors, which is very bad for debugging and overall stability. Always at least log the error to console, or ideally handle it in some way.