1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/lib/error/validate-request.js
2016-12-27 21:03:50 +01:00

16 lines
345 B
JavaScript

'use strict';
const ValidationError = require('./validation-error');
function validateRequest (req) {
return new Promise((resolve, reject) => {
if (req.validationErrors()) {
reject(new ValidationError('Invalid syntax'));
} else {
resolve(req);
}
});
}
module.exports = validateRequest;