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

Commit a60c214

Browse files
committed
Fix error handler in graphql client
1 parent 4b31178 commit a60c214

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/pretty-geese-look.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@shopify/shopify-api": patch
3+
"@shopify/admin-api-client": patch
4+
"@shopify/graphql-client": patch
5+
---
6+
7+
Fix type error in graphql error handler

packages/shopify-api/lib/clients/admin/graphql/client.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,14 @@ export class GraphqlClient {
122122
});
123123

124124
if (response.errors) {
125-
const fetchResponse = response.errors.response!;
125+
const fetchResponse = response.errors.response;
126+
127+
if (!fetchResponse) {
128+
throw new ShopifyErrors.GraphqlQueryError({
129+
message: 'fetch api exception',
130+
response: response as Record<string, any>,
131+
});
132+
}
126133
throwFailedRequest(response, fetchResponse, (options?.retries ?? 0) > 0);
127134
}
128135

0 commit comments

Comments
 (0)