mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Remove useless anonymous functions of files
This commit is contained in:
parent
d7c01e7793
commit
9f10b2928d
37 changed files with 3115 additions and 3189 deletions
|
@ -1,27 +1,25 @@
|
|||
;(function () {
|
||||
'use strict'
|
||||
'use strict'
|
||||
|
||||
var util = require('util')
|
||||
var util = require('util')
|
||||
|
||||
var logger = require('../../helpers/logger')
|
||||
var logger = require('../../helpers/logger')
|
||||
|
||||
var reqValidatorsUtils = {
|
||||
checkErrors: checkErrors
|
||||
var reqValidatorsUtils = {
|
||||
checkErrors: checkErrors
|
||||
}
|
||||
|
||||
function checkErrors (req, res, next, status_code) {
|
||||
if (status_code === undefined) status_code = 400
|
||||
var errors = req.validationErrors()
|
||||
|
||||
if (errors) {
|
||||
logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors })
|
||||
return res.status(status_code).send('There have been validation errors: ' + util.inspect(errors))
|
||||
}
|
||||
|
||||
function checkErrors (req, res, next, status_code) {
|
||||
if (status_code === undefined) status_code = 400
|
||||
var errors = req.validationErrors()
|
||||
return next()
|
||||
}
|
||||
|
||||
if (errors) {
|
||||
logger.warn('Incorrect request parameters', { path: req.originalUrl, err: errors })
|
||||
return res.status(status_code).send('There have been validation errors: ' + util.inspect(errors))
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
return next()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = reqValidatorsUtils
|
||||
})()
|
||||
module.exports = reqValidatorsUtils
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue