multy-stub/server/error.js
Primakov Alexandr Alexandrovich 5d08c4c1c2 update version + logger
2024-12-21 00:05:12 +03:00

14 lines
390 B
JavaScript

const noToken = 'No authorization token was found'
module.exports = (err, req, res, next) => {
if (err.message === noToken) {
res.status(400).send({
success: false, error: 'Токен авторизации не найден',
})
}
res.status(400).send({
success: false, error: err.message || 'Что-то пошло не так',
})
}