Skip to content

Commit edc49fe

Browse files
committed
Tweak some error messages & remove outdated comments
1 parent 425f4ad commit edc49fe

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

frontend/src/graphql.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export const graphqlRequest = async <TData, TVariables>({
3535
variables,
3636
signal,
3737
}: RequestOptions<TData, TVariables>): Promise<TData> => {
38-
const stack = new Error().stack;
3938
let response: Response;
4039
try {
4140
response = await fetch(graphqlEndpoint, {
@@ -50,15 +49,15 @@ export const graphqlRequest = async <TData, TVariables>({
5049
signal,
5150
});
5251
} catch (cause) {
53-
const e = new Error(`GraphQL to ${graphqlEndpoint} request failed`, {
52+
throw new Error(`GraphQL request to ${graphqlEndpoint} request failed`, {
5453
cause,
5554
});
56-
e.stack = stack;
57-
throw e;
5855
}
5956

6057
if (!response.ok) {
61-
throw new Error(`GraphQL request failed: ${response.status}`);
58+
throw new Error(
59+
`GraphQL request to ${graphqlEndpoint} failed: ${response.status}`,
60+
);
6261
}
6362

6463
const json: ExecutionResult<TData> = await response.json();
@@ -67,7 +66,7 @@ export const graphqlRequest = async <TData, TVariables>({
6766
}
6867

6968
if (!json.data) {
70-
throw new Error("GraphQL request returned no data");
69+
throw new Error(`GraphQL request to ${graphqlEndpoint} returned no data`);
7170
}
7271

7372
return json.data;

frontend/tests/routes/render.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ import { afterAll, afterEach, beforeAll } from "vitest";
1515
import { routeTree } from "../../src/routeTree.gen";
1616
import { handlers } from "../mocks/handlers";
1717

18-
// Create a new router instance
19-
2018
export const server = setupServer(...handlers);
2119

2220
// Start server before all tests

0 commit comments

Comments
 (0)