Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new common.errors.IncorrectUsageError({
err: err,
context: 'We cannot find your adapter in: ' + config.getContentPath('storage') + ' or: ' + config.get('paths').internalStoragePath
});
} else {
throw new common.errors.IncorrectUsageError({
message: 'We have detected an error in your custom storage adapter.',
err: err
});
}
}
customStorage = new CustomStorage(storageConfig);
// CASE: if multiple StorageBase modules are installed, instanceof could return false
if (Object.getPrototypeOf(CustomStorage).name !== StorageBase.name) {
throw new common.errors.IncorrectUsageError({
message: 'Your storage adapter does not inherit from the Storage Base.'
});
}
if (!customStorage.requiredFns) {
throw new common.errors.IncorrectUsageError({
message: 'Your storage adapter does not provide the minimum required functions.'
});
}
if (_.xor(customStorage.requiredFns, Object.keys(_.pick(Object.getPrototypeOf(customStorage), customStorage.requiredFns))).length) {
throw new common.errors.IncorrectUsageError({
message: 'Your storage adapter does not provide the minimum required functions.'
});
}
throw new common.errors.IncorrectUsageError({
err,
context: `We cannot find your adapter in: ${config.getContentPath('storage')} or: ${config.get('paths').internalStoragePath}`
});
} else {
throw new common.errors.IncorrectUsageError({
message: 'We have detected an error in your custom storage adapter.',
err
});
}
}
customStorage = new CustomStorage(storageConfig);
// CASE: if multiple StorageBase modules are installed, instanceof could return false
if (Object.getPrototypeOf(CustomStorage).name !== StorageBase.name) {
throw new common.errors.IncorrectUsageError({
message: 'Your storage adapter does not inherit from the Storage Base.'
});
}
if (!customStorage.requiredFns) {
throw new common.errors.IncorrectUsageError({
message: 'Your storage adapter does not provide the minimum required functions.'
});
}
if (_.xor(customStorage.requiredFns, Object.keys(_.pick(Object.getPrototypeOf(customStorage), customStorage.requiredFns))).length) {
throw new common.errors.IncorrectUsageError({
message: 'Your storage adapter does not provide the minimum required functions.'
});
}