From fba8cc70da8e69d0a73e1488ad01913e1f1b7e82 Mon Sep 17 00:00:00 2001 From: Catherine Lee <55311782+c298lee@users.noreply.github.com> Date: Mon, 26 Aug 2024 10:58:41 -0400 Subject: [PATCH] feat(feedback): Improve error message for 403 errors (#13441) If the domain is not in `Allowed Domains` in the Sentry project settings, it would cause a 403 error. The default setting is `*` so this only occurs when the user changes these settings. Fixes https://github.com/getsentry/sentry-javascript/issues/9856 --- packages/feedback/src/core/sendFeedback.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/feedback/src/core/sendFeedback.ts b/packages/feedback/src/core/sendFeedback.ts index ca9875284c6e..c0b8ccaa2704 100644 --- a/packages/feedback/src/core/sendFeedback.ts +++ b/packages/feedback/src/core/sendFeedback.ts @@ -64,6 +64,12 @@ export const sendFeedback: SendFeedback = ( ); } + if (response && typeof response.statusCode === 'number' && response.statusCode === 403) { + return reject( + 'Unable to send Feedback. This could be because this domain is not in your list of allowed domains.', + ); + } + return reject( 'Unable to send Feedback. This could be because of network issues, or because you are using an ad-blocker', );