Improve sentry grouping (#12007)
This PR attemps at improving sentry grouping and filtering by - Using the exceptionCode as the fingerprint when the error is a customException. For this to work in this PR we are now throwing customExceptions instead of internalServerError deprived of their code. They will still be converted to Internal server errors when sent back as response - Filtering 4xx issues where it was missing (for emailVerification because errors were not handled, for invalid captcha and billing errors because they are httpErrors and not graphqlErrors) --------- Co-authored-by: Félix Malfait <felix@twenty.com>
This commit is contained in:
+17
-3
@@ -1,5 +1,19 @@
|
||||
export class InvalidMetadataException extends Error {
|
||||
constructor(message: string) {
|
||||
super(message);
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class InvalidMetadataException extends CustomException {
|
||||
constructor(message: string, code: InvalidMetadataExceptionCode) {
|
||||
super(message, code);
|
||||
}
|
||||
}
|
||||
|
||||
export enum InvalidMetadataExceptionCode {
|
||||
LABEL_REQUIRED = 'Label required',
|
||||
INPUT_TOO_SHORT = 'Input too short',
|
||||
EXCEEDS_MAX_LENGTH = 'Exceeds max length',
|
||||
RESERVED_KEYWORD = 'Reserved keyword',
|
||||
NOT_CAMEL_CASE = 'Not camel case',
|
||||
INVALID_LABEL = 'Invalid label',
|
||||
NAME_NOT_SYNCED_WITH_LABEL = 'Name not synced with label',
|
||||
INVALID_STRING = 'Invalid string',
|
||||
NOT_AVAILABLE = 'Name not available',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user