Files
directus/packages/drive/src/exceptions/InvalidConfig.ts
WoLfulus 42393951e0 Test runners for storage drivers (#4716)
* add tests to drive

* add azure test runner

* add gcs test runner

* add s3 test runner

* quick changes

* Re-add npm run dev

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-04-09 15:40:12 -04:00

24 lines
849 B
TypeScript

import { RuntimeException } from 'node-exceptions';
export class InvalidConfig extends RuntimeException {
private constructor(message: string, status?: number, code?: string) {
super(message, status, code);
}
public static missingDiskName(): InvalidConfig {
return new this('Make sure to define a default disk name inside config file', 500, 'E_INVALID_CONFIG');
}
public static missingDiskConfig(name: string): InvalidConfig {
return new this(`Make sure to define config for ${name} disk`, 500, 'E_INVALID_CONFIG');
}
public static missingDiskDriver(name: string): InvalidConfig {
return new this(`Make sure to define driver for ${name} disk`, 500, 'E_INVALID_CONFIG');
}
public static duplicateDiskName(name: string): InvalidConfig {
return new this(`A disk named ${name} is already defined`, 500, 'E_INVALID_CONFIG');
}
}