Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Fix error handler in graphql client
Browse files Browse the repository at this point in the history
  • Loading branch information
5n00p4eg committed Apr 5, 2024
1 parent 4b31178 commit a60c214
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changeset/pretty-geese-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@shopify/shopify-api": patch
"@shopify/admin-api-client": patch
"@shopify/graphql-client": patch
---

Fix type error in graphql error handler
9 changes: 8 additions & 1 deletion packages/shopify-api/lib/clients/admin/graphql/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,14 @@ export class GraphqlClient {
});

if (response.errors) {
const fetchResponse = response.errors.response!;
const fetchResponse = response.errors.response;

if (!fetchResponse) {
throw new ShopifyErrors.GraphqlQueryError({
message: 'fetch api exception',
response: response as Record<string, any>,
});
}
throwFailedRequest(response, fetchResponse, (options?.retries ?? 0) > 0);
}

Expand Down

0 comments on commit a60c214

Please sign in to comment.