]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/middlewares/validators/utils.js
3741b84c65c4c98ef7e26db287d9b25987704cf5
3 const util
= require('util')
5 const logger
= require('../../helpers/logger')
7 const validatorsUtils
= {
11 function checkErrors (req
, res
, next
, statusCode
) {
12 if (statusCode
=== undefined) statusCode
= 400
13 const errors
= req
.validationErrors()
16 logger
.warn('Incorrect request parameters', { path: req
.originalUrl
, err: errors
})
17 return res
.status(statusCode
).send('There have been validation errors: ' + util
.inspect(errors
))
23 // ---------------------------------------------------------------------------
25 module
.exports
= validatorsUtils