fix: use ForbiddenException in DevelopmentGuard to prevent Sentry noise (#18378)
This commit is contained in:
+7
-4
@@ -1,3 +1,5 @@
|
||||
import { HttpException } from '@nestjs/common';
|
||||
|
||||
import { type I18n } from '@lingui/core';
|
||||
import { msg } from '@lingui/core/macro';
|
||||
|
||||
@@ -5,16 +7,17 @@ import {
|
||||
BaseGraphQLError,
|
||||
ErrorCode,
|
||||
} from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
||||
import { convertExceptionToGraphQLError } from 'src/engine/utils/global-exception-handler.util';
|
||||
import { CustomException } from 'src/utils/custom-exception';
|
||||
|
||||
export const generateGraphQLErrorFromError = (
|
||||
error: Error | CustomException,
|
||||
i18n: I18n,
|
||||
) => {
|
||||
const graphqlError = new BaseGraphQLError(
|
||||
error.message,
|
||||
ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
const graphqlError =
|
||||
error instanceof HttpException
|
||||
? convertExceptionToGraphQLError(error)
|
||||
: new BaseGraphQLError(error.message, ErrorCode.INTERNAL_SERVER_ERROR);
|
||||
|
||||
const defaultErrorMessage = msg`An error occurred.`;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user