1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/error/validate-request.js
2020-02-20 08:30:45 +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;