1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/error/validateRequest.js

14 lines
366 B
JavaScript
Raw Normal View History

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;