Skip to content

Commit c457fae

Browse files
committed
feat: Add new option for enhanceFetchErrorMessages
1 parent a204aac commit c457fae

File tree

1 file changed

+12
-0
lines changed
  • docs/platforms/javascript/common/configuration

1 file changed

+12
-0
lines changed

docs/platforms/javascript/common/configuration/options.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,18 @@ By the time `beforeSend` is executed, all scope data has already been applied to
341341

342342
</SdkOption>
343343

344+
<SdkOption name="enhanceFetchErrorMessages" type="'always' | 'report-only' | false" defaultValue="'always'">
345+
346+
Controls whether and how to enhance fetch error messages by appending the request hostname. Generic fetch errors like "Failed to fetch" will be enhanced to include the hostname (e.g., "Failed to fetch (example.com)") to provide better context in Sentry.
347+
348+
Available options:
349+
350+
- `'always'` (default): Modifies the actual error message directly. This may break third-party packages that rely on exact message matching (e.g., `is-network-error`, `p-retry`).
351+
- `'report-only'`: Only enhances the message when sending to Sentry. The original error message remains unchanged, preserving compatibility with third-party packages that check error messages.
352+
- `false`: Disables hostname enhancement completely.
353+
354+
</SdkOption>
355+
344356
<SdkOption name="ignoreErrors" type='Array<string | RegExp>' defaultValue='[]'>
345357

346358
<Include name="platforms/configuration/options/ignore-errors.mdx" />

0 commit comments

Comments
 (0)