Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(row => {
if (row) {
// eslint-disable-next-line prefer-const
let errors = {};
property.forEach(prop => {
errors[prop] = [
{
message: `${prop} is already taken.`,
},
];
});
return reject(new ValidationError(errors));
}
return resolve();
})
.catch(reject);
.then(row => {
if (row) {
// eslint-disable-next-line prefer-const
let errors = {};
property.forEach(prop => {
errors[prop] = [
{
message: `${prop} is already taken.`,
},
];
});
return reject(new ValidationError(errors));
}
return resolve();
})
.catch(reject);
.then(row => {
if (row) {
return reject(
new ValidationError({
[property]: [
{
message: `${property} is already taken.`,
},
],
}),
);
}
return resolve();
})
.catch(reject);
$afterValidate(json) {
if (
json.baseScreenshotId &&
json.baseScreenshotId === json.compareScreenshotId
) {
throw new ValidationError({
type: ValidationError.Type.ModelValidation,
message: 'The base screenshot should be different to the compare one.',
})
}
}
}
$afterValidate(json) {
if (
json.baseScreenshotBucketId &&
json.baseScreenshotBucketId === json.compareScreenshotBucketId
) {
throw new ValidationError({
type: ValidationError.Type.ModelValidation,
message:
'The base screenshot bucket should be different to the compare one.',
})
}
}
.then(row => {
if (row) {
return reject(
new ValidationError({
[property]: [
{
message: `${property} is already taken.`,
},
],
}),
);
}
return resolve();
})
.catch(reject);