refactor messaging error handling (#15416)

This commit is contained in:
neo773
2025-11-02 00:33:41 +05:30
committed by GitHub
parent c42c2590de
commit 44c0b9f94b
39 changed files with 454 additions and 282 deletions
@@ -9,6 +9,7 @@ import { type ExceptionHandlerOptions } from 'src/engine/core-modules/exception-
import { PostgresException } from 'src/engine/api/graphql/workspace-query-runner/utils/postgres-exception';
import { type ExceptionHandlerDriverInterface } from 'src/engine/core-modules/exception-handler/interfaces';
import { MessageImportDriverException } from 'src/modules/messaging/message-import-manager/drivers/exceptions/message-import-driver.exception';
import { CustomException } from 'src/utils/custom-exception';
export class ExceptionHandlerSentryDriver
@@ -61,6 +62,20 @@ export class ExceptionHandlerSentryDriver
});
}
if ('context' in exception && exception.context) {
Object.entries(exception.context).forEach(([key, value]) => {
scope.setExtra(key, value);
});
}
if ('cause' in exception && exception.cause) {
scope.setContext('cause', {
name: exception.cause.name,
message: exception.cause.message,
stack: exception.cause.stack,
});
}
if (
exception instanceof CustomException &&
exception.code !== 'UNKNOWN'
@@ -84,6 +99,11 @@ export class ExceptionHandlerSentryDriver
exception.name = exception.message;
}
if (exception instanceof MessageImportDriverException) {
scope.setTag('messageImportDriverCode', exception.code);
scope.setFingerprint([exception.code]);
}
const eventId = Sentry.captureException(exception, {
contexts: {
GraphQL: {