mirror of
https://github.com/directus/directus.git
synced 2026-02-06 05:05:00 -05:00
* Add "required" option to fields * Move some exceptions to shared * Do client side validation for required * Add conditional required support
18 lines
471 B
TypeScript
18 lines
471 B
TypeScript
import { BaseException } from '@directus/shared/exceptions';
|
|
|
|
type Extensions = {
|
|
collection: string;
|
|
field: string;
|
|
invalid?: string;
|
|
};
|
|
|
|
export class InvalidForeignKeyException extends BaseException {
|
|
constructor(field: string | null, extensions?: Extensions) {
|
|
if (field) {
|
|
super(`Invalid foreign key in field "${field}".`, 400, 'INVALID_FOREIGN_KEY', extensions);
|
|
} else {
|
|
super(`Invalid foreign key.`, 400, 'INVALID_FOREIGN_KEY', extensions);
|
|
}
|
|
}
|
|
}
|