1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/error/validateRequest.js
2020-02-20 08:30:18 +01:00

14 lines
366 B
JavaScript

var Promise = require("bluebird");
var ValidationError = require('./ValidationError');
function validateRequest(req) {
return new Promise(function(resolve, reject) {
if (req.validationErrors()) {
reject(new ValidationError("Invalid syntax"));
} else {
resolve(req);
}
});
}
module.exports = validateRequest;