chore: improve monitoring for fix(ai): stop querying removed MarketplaceApp fiel
I reduced monitoring noise in the shared Apollo error handler by filtering `GRAPHQL_VALIDATION_FAILED` GraphQL errors from Sentry capture, alongside existing expected-error filters. These errors are typically frontend/query-shape validation failures that are non-actionable at runtime and can otherwise flood error monitoring. I also added a corresponding ApolloFactory test case to lock this behavior and ensure `onError` still fires for UI handling while avoiding escalation paths intended for unexpected server failures.
This commit is contained in:
@@ -192,6 +192,35 @@ describe('ApolloFactory', () => {
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
it('should call onError when encountering "GRAPHQL_VALIDATION_FAILED" error', async () => {
|
||||
const errors = [
|
||||
{
|
||||
message: 'Cannot query field "icon" on type "MarketplaceApp".',
|
||||
extensions: {
|
||||
code: 'GRAPHQL_VALIDATION_FAILED',
|
||||
},
|
||||
},
|
||||
];
|
||||
fetchMock.mockResponse(() =>
|
||||
Promise.resolve({
|
||||
body: JSON.stringify({
|
||||
data: {},
|
||||
errors,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
try {
|
||||
await makeRequest();
|
||||
} catch (error) {
|
||||
expect(error).toBeInstanceOf(CombinedGraphQLErrors);
|
||||
expect((error as CombinedGraphQLErrors).message).toBe(
|
||||
'Cannot query field "icon" on type "MarketplaceApp".',
|
||||
);
|
||||
expect(mockOnError).toHaveBeenCalledWith(errors);
|
||||
}
|
||||
}, 10000);
|
||||
|
||||
it('should call onNetworkError when encountering a network error', async () => {
|
||||
const errors = [
|
||||
{
|
||||
|
||||
@@ -294,7 +294,8 @@ export class ApolloFactory implements ApolloManager {
|
||||
case 'BAD_USER_INPUT':
|
||||
case 'FORBIDDEN':
|
||||
case 'CONFLICT':
|
||||
case 'METADATA_VALIDATION_FAILED': {
|
||||
case 'METADATA_VALIDATION_FAILED':
|
||||
case 'GRAPHQL_VALIDATION_FAILED': {
|
||||
return;
|
||||
}
|
||||
case 'USER_INPUT_ERROR': {
|
||||
|
||||
Reference in New Issue
Block a user