Skip to content

Commit

Permalink
fix: init errorMessage as empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
crackheadakira committed Feb 15, 2025
1 parent a838c4b commit 41d6632
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/graphQLRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export async function graphQLRequest<QueryKey extends Query>(queryKey: QueryKey,
const res = await fetch(url, reqOptions)
const resJson = await res.json() as GraphQLResponse;
if (!res.ok) {
let errorMessage;
let errorMessage = "";
if (resJson.errors) errorMessage = resJson.errors[0].message;
throw new YuukoError(`${res.status} ${errorMessage.length > 0 ? errorMessage : ""} ${res.statusText}`, vars);
}
Expand Down

0 comments on commit 41d6632

Please sign in to comment.