From c9a24a0d28243bd019018030fdf9576eea51f2a5 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Wed, 20 Oct 2021 16:49:58 +0530 Subject: [PATCH] fix: improper parsed error checks --- packages/hoppscotch-app/helpers/backend/GQLClient.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/hoppscotch-app/helpers/backend/GQLClient.ts b/packages/hoppscotch-app/helpers/backend/GQLClient.ts index 7ca2d450c..5af67c7d2 100644 --- a/packages/hoppscotch-app/helpers/backend/GQLClient.ts +++ b/packages/hoppscotch-app/helpers/backend/GQLClient.ts @@ -201,7 +201,7 @@ export const useGQLQuery = ( (gqlErr) => >{ type: "gql_error", - error: gqlErr as DocErrorType, + error: parseGQLErrorString(gqlErr ?? "") as DocErrorType, }, // The right case (it was a GraphQL Error) (networkErr) => @@ -244,6 +244,8 @@ export const useGQLQuery = ( return response } +const parseGQLErrorString = (s: string) => s.startsWith("[GraphQL] ") ? s.split("[GraphQL] ")[1] : s + export const runMutation = < DocType, DocVariables extends object | undefined,