Допустим, у меня есть ошибка:
.catch((err) => {
res.sendFile(path.join(__dirname, '..', 'public', 'url-error.html'));
console.log(err.message);
});
Как проверить тип ошибки?
Например,
if (err.message.toLowerCase().contains('invalid operator')) {
console.log('this is me doing something in this block');
} else {
console.log('nothing is happening here');
}
PS Я получаю сообщение об ошибке от библиотека в Node.JS с именем "ytdl-core".