From 25c3dc7b5e80f32bbefe66673c082b4d1ed2397d Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Thu, 21 Jul 2022 19:53:26 +0100 Subject: [PATCH] fix(remix): Do not capture 4xx codes from thrown responses. (#5441) Fixes: #5425 Ref: #5429, #5405 As per review https://github.com/getsentry/sentry-javascript/pull/5429#issuecomment-1189139234, we need to define how and when we should capture a 4xx error. We will only capture thrown 5xx responses until then. --- packages/remix/src/utils/instrumentServer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/remix/src/utils/instrumentServer.ts b/packages/remix/src/utils/instrumentServer.ts index 4f1195aa5796..0301f7919fab 100644 --- a/packages/remix/src/utils/instrumentServer.ts +++ b/packages/remix/src/utils/instrumentServer.ts @@ -100,9 +100,9 @@ function extractData(response: Response): Promise { } function captureRemixServerException(err: Error, name: string): void { - // Skip capturing if the thrown error is an OK Response + // Skip capturing if the thrown error is not a 5xx response // https://remix.run/docs/en/v1/api/conventions#throwing-responses-in-loaders - if (isResponse(err) && err.status < 400) { + if (isResponse(err) && err.status < 500) { return; }