Skip to content

Commit 1580630

Browse files
Report user errors from graphql as handled
1 parent a3582f5 commit 1580630

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/cli-kit/src/private/node/api/graphql.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ Request ID: ${requestId}
8282
`
8383
}
8484
let mappedError: Error
85-
if (status < 500) {
86-
mappedError = new GraphQLClientError(errorMessage, status, error.response.errors)
87-
} else {
85+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
86+
if (error.response.errors?.every((graphqlError: any) => graphqlError.type === 'GraphApi::UserError')) {
8887
mappedError = new AbortError(errorMessage)
88+
} else {
89+
mappedError = new GraphQLClientError(errorMessage, status, error.response.errors)
8990
}
9091
return mappedError
9192
} else {

0 commit comments

Comments
 (0)