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:
@ -148,16 +148,21 @@ export class CalendarEventImportErrorHandlerService {
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
this.exceptionHandlerService.captureExceptions([exception], {
|
||||
workspace: {
|
||||
id: workspaceId,
|
||||
},
|
||||
});
|
||||
|
||||
throw new CalendarEventImportException(
|
||||
const calendarEventImportException = new CalendarEventImportException(
|
||||
`Unknown error importing calendar events for calendar channel ${calendarChannel.id} in workspace ${workspaceId}: ${exception.message}`,
|
||||
CalendarEventImportExceptionCode.UNKNOWN,
|
||||
);
|
||||
|
||||
this.exceptionHandlerService.captureExceptions(
|
||||
[calendarEventImportException],
|
||||
{
|
||||
workspace: {
|
||||
id: workspaceId,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
throw calendarEventImportException;
|
||||
}
|
||||
|
||||
private async handleNotFoundException(
|
||||
|
||||
@ -162,7 +162,10 @@ export class MessageImportExceptionHandlerService {
|
||||
);
|
||||
|
||||
this.exceptionHandlerService.captureExceptions([
|
||||
`Unknown error importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`,
|
||||
new MessageImportException(
|
||||
`Unknown error importing messages for message channel ${messageChannel.id} in workspace ${workspaceId}: ${exception.message}`,
|
||||
MessageImportExceptionCode.UNKNOWN,
|
||||
),
|
||||
]);
|
||||
|
||||
throw new MessageImportException(
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export class WorkflowTriggerException extends CustomException {
|
||||
declare code: WorkflowTriggerExceptionCode;
|
||||
constructor(message: string, code: WorkflowTriggerExceptionCode) {
|
||||
super(message, code);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user