diff --git a/packages/backend/src/common/error/exception.filter.ts b/packages/backend/src/common/error/exception.filter.ts index 2090938cc2..06bf58ad51 100644 --- a/packages/backend/src/common/error/exception.filter.ts +++ b/packages/backend/src/common/error/exception.filter.ts @@ -16,6 +16,7 @@ export class MainExceptionFilter implements ExceptionFilter { const status = exception instanceof HttpException ? exception.getStatus() : HttpStatus.INTERNAL_SERVER_ERROR; let message = 'Internal server error'; + let cause: unknown; if (status === HttpStatus.INTERNAL_SERVER_ERROR) { this.logger.error(`An error occured while calling: ${request.url}`, exception); @@ -34,6 +35,7 @@ export class MainExceptionFilter implements ExceptionFilter { let intlParams: Record | undefined; if (exception instanceof TranslatableError) { const response = exception.getResponse(); + cause = exception.cause; if (typeof response === 'string') { message = response; @@ -48,6 +50,7 @@ export class MainExceptionFilter implements ExceptionFilter { if (status >= 500 && !(exception instanceof TranslatableError)) { Sentry.captureException(exception, { tags: { + cause: String(cause), url: request.url, status, }, @@ -59,6 +62,7 @@ export class MainExceptionFilter implements ExceptionFilter { message, path: request.url, intlParams, + cause, }); } } diff --git a/packages/backend/src/modules/app-lifecycle/app-lifecycle.service.ts b/packages/backend/src/modules/app-lifecycle/app-lifecycle.service.ts index db7ee60adf..ef80bab1ce 100644 --- a/packages/backend/src/modules/app-lifecycle/app-lifecycle.service.ts +++ b/packages/backend/src/modules/app-lifecycle/app-lifecycle.service.ts @@ -325,7 +325,7 @@ export class AppLifecycleService { if (!success) { this.logger.error(`Failed to update app ${appId}: ${message}`); - throw new TranslatableError('APP_ERROR_APP_FAILED_TO_UPDATE', { id: appId }); + throw new TranslatableError('APP_ERROR_APP_FAILED_TO_UPDATE', { id: appId }, HttpStatus.INTERNAL_SERVER_ERROR, { cause: message }); } await this.appRepository.updateApp(appId, {