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
2014-12-10 19:11:52 +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;