Add exceptions for metadata modules (#6070)

Class exception for each metadata module + handler to map on graphql
error

TODO left :
- find a way to call handler on auto-resolvers nestjs query (probably
interceptors)
- discuss what should be done for pre-hooks errors
- discuss what should be done for Unauthorized exception
This commit is contained in:
Thomas Trompette
2024-07-01 13:49:17 +02:00
committed by GitHub
parent 4599f43b6c
commit a15884ea0a
48 changed files with 815 additions and 199 deletions

View File

@ -0,0 +1,17 @@
import { CustomException } from 'src/utils/custom-exception';
export class FieldMetadataException extends CustomException {
code: FieldMetadataExceptionCode;
constructor(message: string, code: FieldMetadataExceptionCode) {
super(message, code);
}
}
export enum FieldMetadataExceptionCode {
FIELD_METADATA_NOT_FOUND = 'FIELD_METADATA_NOT_FOUND',
INVALID_FIELD_INPUT = 'INVALID_FIELD_INPUT',
FIELD_MUTATION_NOT_ALLOWED = 'FIELD_MUTATION_NOT_ALLOWED',
FIELD_ALREADY_EXISTS = 'FIELD_ALREADY_EXISTS',
OBJECT_METADATA_NOT_FOUND = 'OBJECT_METADATA_NOT_FOUND',
INTERNAL_SERVER_ERROR = 'INTERNAL_SERVER_ERROR',
}