Add relation exceptions (#12185)

Introducing a class of RelationException extending CustomException to
help grouping those exception in sentries by ExceptionCode.
I did not introduce a filter as these are thrown in utils that can be
used in multiple places now or in the future, and filters are to be
added at resolver-level.
This commit is contained in:
Marie
2025-05-21 15:53:25 +02:00
committed by GitHub
parent c982bcdb52
commit 8c6569be3b
5 changed files with 59 additions and 9 deletions

View File

@ -0,0 +1,18 @@
import { CustomException } from 'src/utils/custom-exception';
export class RelationException extends CustomException {
declare code: RelationExceptionCode;
constructor(message: string, code: RelationExceptionCode) {
super(message, code);
}
}
export enum RelationExceptionCode {
RELATION_OBJECT_METADATA_NOT_FOUND = 'RELATION_OBJECT_METADATA_NOT_FOUND',
RELATION_TARGET_FIELD_METADATA_ID_NOT_FOUND = 'RELATION_TARGET_FIELD_METADATA_ID_NOT_FOUND',
RELATION_TARGET_FIELD_METADATA_NOT_FOUND = 'RELATION_TARGET_FIELD_METADATA_NOT_FOUND',
INVALID_RELATION_TYPE = 'INVALID_RELATION_TYPE',
RELATION_JOIN_COLUMN_ON_BOTH_SIDES = 'RELATION_JOIN_COLUMN_ON_BOTH_SIDES',
MISSING_RELATION_JOIN_COLUMN = 'MISSING_RELATION_JOIN_COLUMN',
MULTIPLE_JOIN_COLUMNS_FOUND = 'MULTIPLE_JOIN_COLUMNS_FOUND',
}