From 69ac841954e594866bb945bacc690fee968f6862 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 28 Sep 2026 08:49:28 +0000 Subject: [PATCH 1/2] docs(javascript): Document report dialog load errors Co-Authored-By: Andrei Borza --- .../common/user-feedback/configuration/index.mdx | 7 +++++++ .../example-widget-onerror/javascript.mdx | 11 +++++++++++ 2 files changed, 18 insertions(+) create mode 100644 platform-includes/user-feedback/example-widget-onerror/javascript.mdx diff --git a/docs/platforms/javascript/common/user-feedback/configuration/index.mdx b/docs/platforms/javascript/common/user-feedback/configuration/index.mdx index 17c1d80e8acee..2abaf04268768 100644 --- a/docs/platforms/javascript/common/user-feedback/configuration/index.mdx +++ b/docs/platforms/javascript/common/user-feedback/configuration/index.mdx @@ -564,6 +564,7 @@ You can customize the Crash-Report modal to your organization's needs, for examp | `successMessage` | Your feedback has been sent. Thank you! | | `onLoad` | n/a - (**An optional callback that will be invoked when the widget opens.**) | | `onClose` | n/a - (**An optional callback that will be invoked when the widget closes.**) | +| `onError` | n/a - (**An optional callback that receives an `Error` if the dialog script fails to load.**) | The optional callback `onLoad` will be called when users see the widget. You can use this to run custom logic, for example to log an analytics event: @@ -572,3 +573,9 @@ The optional callback `onLoad` will be called when users see the widget. You can The optional callback `onClose` will be called when users close the widget. You can use this to run custom logic, for example to reload the page: + +Ad blockers or network problems can prevent the dialog script from loading. Use the optional `onError` callback to display a message when this happens. It receives an `Error` with the message `Failed to load the report dialog script`. + + + +The `onError` callback only handles script-loading failures, not errors when submitting feedback. diff --git a/platform-includes/user-feedback/example-widget-onerror/javascript.mdx b/platform-includes/user-feedback/example-widget-onerror/javascript.mdx new file mode 100644 index 0000000000000..8c3f0f565a195 --- /dev/null +++ b/platform-includes/user-feedback/example-widget-onerror/javascript.mdx @@ -0,0 +1,11 @@ +```javascript +Sentry.showReportDialog({ + // ... + onError(error) { + console.error(error.message); + window.alert( + "The feedback form could not load. Check your connection or ad blocker settings and try again." + ); + }, +}); +``` From 5799d16601eb8945aa96f20295ecf8e170bc9f30 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 28 Sep 2026 09:29:45 +0000 Subject: [PATCH 2/2] docs(javascript): Clarify report dialog error callback scope --- .../common/user-feedback/configuration/index.mdx | 9 ++++++--- .../user-feedback/example-widget-onerror/javascript.mdx | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/platforms/javascript/common/user-feedback/configuration/index.mdx b/docs/platforms/javascript/common/user-feedback/configuration/index.mdx index 2abaf04268768..1f60c2fc63a4f 100644 --- a/docs/platforms/javascript/common/user-feedback/configuration/index.mdx +++ b/docs/platforms/javascript/common/user-feedback/configuration/index.mdx @@ -564,7 +564,7 @@ You can customize the Crash-Report modal to your organization's needs, for examp | `successMessage` | Your feedback has been sent. Thank you! | | `onLoad` | n/a - (**An optional callback that will be invoked when the widget opens.**) | | `onClose` | n/a - (**An optional callback that will be invoked when the widget closes.**) | -| `onError` | n/a - (**An optional callback that receives an `Error` if the dialog script fails to load.**) | +| `onError` | n/a - (**An optional callback that receives an `Error` if the dialog cannot be shown.**) | The optional callback `onLoad` will be called when users see the widget. You can use this to run custom logic, for example to log an analytics event: @@ -574,8 +574,11 @@ The optional callback `onClose` will be called when users close the widget. You -Ad blockers or network problems can prevent the dialog script from loading. Use the optional `onError` callback to display a message when this happens. It receives an `Error` with the message `Failed to load the report dialog script`. +The dialog cannot open without an event ID or if its script fails to load. Use the optional `onError` callback to handle these failures. It receives an `Error` with one of these messages: + +- `No event ID to show the report dialog for`: Neither the `eventId` option nor `Sentry.lastEventId()` provides an event ID. +- `Failed to load the report dialog script`: The script failed to load, for example, because of an ad blocker or network problem. -The `onError` callback only handles script-loading failures, not errors when submitting feedback. +The `onError` callback handles failures when opening the dialog, not errors when submitting a report. diff --git a/platform-includes/user-feedback/example-widget-onerror/javascript.mdx b/platform-includes/user-feedback/example-widget-onerror/javascript.mdx index 8c3f0f565a195..2db2a0a5e2a88 100644 --- a/platform-includes/user-feedback/example-widget-onerror/javascript.mdx +++ b/platform-includes/user-feedback/example-widget-onerror/javascript.mdx @@ -4,7 +4,7 @@ Sentry.showReportDialog({ onError(error) { console.error(error.message); window.alert( - "The feedback form could not load. Check your connection or ad blocker settings and try again." + "The report form could not load. Check your connection or ad blocker settings and try again." ); }, });