multy-stub/server/error.js

14 lines
390 B
JavaScript
Raw Permalink Normal View History

2023-08-01 13:14:02 +03:00
const noToken = 'No authorization token was found'
module.exports = (err, req, res, next) => {
if (err.message === noToken) {
res.status(400).send({
success: false, error: 'Токен авторизации не найден',
})
}
2024-12-21 00:05:12 +03:00
2023-08-01 13:14:02 +03:00
res.status(400).send({
success: false, error: err.message || 'Что-то пошло не так',
})
}