Skip to content

Commit 5b01862

Browse files
MahmoudMahmoud
Mahmoud
authored and
Mahmoud
committed
Throw error sent to catch without adding extra copy
1 parent 1330198 commit 5b01862

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

spotlight-client/src/metricsApi/fetchMetrics.test.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ describe("fetchAndTransformMetric", () => {
149149
tenantId: "US_ND",
150150
});
151151
} catch (e) {
152-
expect(e.message).toBe(
153-
`There was a network error attempting to fetch metrics: \nError: Network error`
154-
);
152+
expect(e.message).toBe(`Error: Network error`);
155153
}
156154

157155
fetchMock.resetMocks();

spotlight-client/src/metricsApi/fetchMetrics.ts

+1-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ export async function fetchMetrics({
7373
}`
7474
);
7575
} catch (error) {
76-
throw new Error(
77-
`There was a network error attempting to fetch metrics: \n${error}`
78-
);
76+
throw new Error(`${error}`);
7977
}
8078
}
8179

0 commit comments

Comments
 (0)