Better errors handling (#8835)

- [ ] Catch this specific `500` error
- [ ] Make sure catched `500` errors are sent to sentry for the Cloud
version
- [ ] Hide the option to sync email with google in this situation where
the according env var is missing
- [x] Add Worskpace information to all catched errors for better
debugging

fix #8607
This commit is contained in:
Guillim
2024-12-03 12:16:38 +01:00
committed by GitHub
parent 32194a88b3
commit 7e4277fbe4
28 changed files with 120 additions and 104 deletions

View File

@ -8,10 +8,10 @@ import { GraphQLError, Kind, OperationDefinitionNode, print } from 'graphql';
import { GraphQLContext } from 'src/engine/api/graphql/graphql-config/interfaces/graphql-context.interface';
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
import { generateGraphQLErrorFromError } from 'src/engine/core-modules/graphql/utils/generate-graphql-error-from-error.util';
import { BaseGraphQLError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
import { shouldCaptureException } from 'src/engine/core-modules/graphql/utils/should-capture-exception.util';
import { ExceptionHandlerService } from 'src/engine/core-modules/exception-handler/exception-handler.service';
type GraphQLErrorHandlerHookOptions = {
/**
@ -93,6 +93,14 @@ export const useGraphQLErrorHandlerHook = <
},
document,
user,
workspace: {
id: args.contextValue.req.workspace?.id,
displayName: args.contextValue.req.workspace?.displayName,
createdAt:
args.contextValue.req.workspace?.createdAt.toISOString(),
activationStatus:
args.contextValue.req.workspace?.activationStatus,
},
},
);