Skip to content

Commit 5c89c28

Browse files
committed
give the thrown error a more distinctive name
1 parent ed6d624 commit 5c89c28

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/nextjs/test/utils/withSentry.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ const flushSpy = jest.spyOn(Sentry, 'flush').mockImplementation(async () => {
4747
describe('withSentry', () => {
4848
let req: NextApiRequest, res: NextApiResponse;
4949

50-
const error = new Error('Oh, no! Charlie ate the flip-flops! :-(');
50+
const noShoesError = new Error('Oh, no! Charlie ate the flip-flops! :-(');
5151

5252
const origHandlerNoError: NextApiHandler = async (_req, res) => {
5353
res.send('Good dog, Maisey!');
5454
};
5555
const origHandlerWithError: NextApiHandler = async (_req, _res) => {
56-
throw error;
56+
throw noShoesError;
5757
};
5858

5959
const wrappedHandlerNoError = withSentry(origHandlerNoError);
@@ -80,10 +80,10 @@ describe('withSentry', () => {
8080
try {
8181
await callWrappedHandler(wrappedHandlerWithError, req, res);
8282
} catch (err) {
83-
expect(err).toBe(error);
83+
expect(err).toBe(noShoesError);
8484
}
8585

86-
expect(captureExceptionSpy).toHaveBeenCalledWith(error);
86+
expect(captureExceptionSpy).toHaveBeenCalledWith(noShoesError);
8787
expect(flushSpy).toHaveBeenCalled();
8888
expect(loggerSpy).toHaveBeenCalledWith('Done flushing events');
8989

0 commit comments

Comments
 (0)