Skip to content

The only tool you need to know what is happening and how to fix it.

better docs

dduxddad4f40c4f9
diff --git a/docs/pages/client/jquery/index.mdx b/docs/pages/client/jquery/index.mdx
index cad567df..cb1507f0 100644
--- a/docs/pages/client/jquery/index.mdx
+++ b/docs/pages/client/jquery/index.mdx
@@ -78,6 +78,43 @@ init("your-token@https://cloud.tracewayapp.com/api/report", {
});
```
+### Options Reference
+
+| Option | Type | Default | Description |
+|--------|------|---------|-------------|
+| `debug` | `boolean` | `false` | Log captured events to the browser console |
+| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |
+| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |
+| `version` | `string` | `undefined` | Your application version |
+| `ignoreErrors` | `Array<string \| RegExp>` | `DEFAULT_IGNORE_PATTERNS` | Error patterns to ignore. Pass `[]` to capture all errors. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
+| `beforeCapture` | `(exception) => boolean` | `undefined` | Return `false` to suppress an error. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
+
+## Error Filtering
+
+By default, 4xx AJAX errors (e.g., 401, 422), network errors, and timeouts are **not** captured. This means `$.ajax()` calls that return 4xx status codes will not appear in your Traceway dashboard unless you opt in.
+
+To capture all AJAX errors including 4xx:
+
+```javascript
+init("your-token@https://cloud.tracewayapp.com/api/report", {
+ ignoreErrors: [],
+});
+```
+
+The jQuery SDK records HTTP status codes as attributes on captured errors. You can use `beforeCapture` to selectively filter by status:
+
+```javascript
+init("your-token@https://cloud.tracewayapp.com/api/report", {
+ ignoreErrors: [],
+ beforeCapture: (exception) => {
+ // Only capture 5xx server errors from AJAX
+ const status = Number(exception.attributes?.status);
+ if (status >= 400 && status < 500) return false;
+ return true;
+ },
+});
+```
+
## Distributed Tracing
The SDK automatically instruments both `XMLHttpRequest` (used by `$.ajax()`) and `fetch` to propagate a `traceway-trace-id` header on same-origin requests. This links frontend errors to the backend requests that caused them.
diff --git a/docs/pages/client/js-sdk/initialization.mdx b/docs/pages/client/js-sdk/initialization.mdx
index 669804d1..a8cb5fb6 100644
--- a/docs/pages/client/js-sdk/initialization.mdx
+++ b/docs/pages/client/js-sdk/initialization.mdx
@@ -30,6 +30,8 @@ init("your-token@https://traceway.example.com/api/report", {
| `debounceMs` | `number` | `1500` | Milliseconds to wait before sending batched events |
| `retryDelayMs` | `number` | `10000` | Milliseconds to wait before retrying failed uploads |
| `version` | `string` | `undefined` | Your application version (shown in Traceway dashboard) |
+| `ignoreErrors` | `Array<string \| RegExp>` | `DEFAULT_IGNORE_PATTERNS` | Patterns to filter out errors before capture. See [Error Filtering](#error-filtering) |
+| `beforeCapture` | `(exception) => boolean` | `undefined` | Callback to programmatically suppress errors. Return `false` to drop. See [Error Filtering](#error-filtering) |
## Auto-Capture Behavior
@@ -54,6 +56,78 @@ window.addEventListener("unhandledrejection", (event) => {
});
```
+## Error Filtering
+
+By default, the SDK ignores common non-actionable errors: **4xx HTTP errors**, **network errors**, and **timeouts**. These are typically expected application behavior (e.g., form validation returning 422, auth redirects from 401) rather than bugs that need tracking.
+
+### Default Behavior
+
+The following patterns are ignored out of the box:
+
+- `"Failed to fetch"` (Chrome), `"Load failed"` (Safari), `"NetworkError when attempting to fetch resource"` (Firefox), `"Network Error"` (Axios)
+- `"The operation was aborted"` (AbortController), any message matching `/timeout/i`
+- Axios 4xx errors matching `/status code 4\d{2}/`
+- jQuery/custom 4xx errors matching `/failed: 4\d{2}/`
+
+### Capture All Errors
+
+To opt out of default filtering and capture everything:
+
+```javascript
+init("your-token@https://traceway.example.com/api/report", {
+ ignoreErrors: [],
+});
+```
+
+### Custom Patterns
+
+Pass your own patterns to replace the defaults. Strings match via `includes()`, RegExps match via `.test()`:
+
+```javascript
+init("your-token@https://traceway.example.com/api/report", {
+ ignoreErrors: [
+ "ResizeObserver loop",
+ /status code 5\d{2}/,
+ ],
+});
+```
+
+### Extending Default Patterns
+
+Import `DEFAULT_IGNORE_PATTERNS` to add your own patterns on top of the defaults:
+
+```javascript
+import { init, DEFAULT_IGNORE_PATTERNS } from "@tracewayapp/frontend";
+
+init("your-token@https://traceway.example.com/api/report", {
+ ignoreErrors: [
+ ...DEFAULT_IGNORE_PATTERNS,
+ "ResizeObserver loop",
+ ],
+});
+```
+
+### beforeCapture Callback
+
+For fine-grained control, use the `beforeCapture` callback. It receives the full exception object (including any attributes) and should return `false` to suppress:
+
+```javascript
+init("your-token@https://traceway.example.com/api/report", {
+ ignoreErrors: [],
+ beforeCapture: (exception) => {
+ // Suppress 401 errors based on attributes (e.g., from jQuery AJAX capture)
+ if (exception.attributes?.status === "401") return false;
+
+ // Suppress errors from third-party scripts
+ if (exception.stackTrace.includes("third-party.js")) return false;
+
+ return true;
+ },
+});
+```
+
+`beforeCapture` is checked **after** `ignoreErrors` — if a pattern already suppresses the error, the callback is not called. If the callback throws, the error is captured normally (safe default).
+
## Debug Mode
When `debug: true` is set, the SDK logs all captured events to the browser console. This is useful during development to verify events are being captured correctly.
diff --git a/docs/pages/client/react/provider.mdx b/docs/pages/client/react/provider.mdx
index 61e59b55..4a352df5 100644
--- a/docs/pages/client/react/provider.mdx
+++ b/docs/pages/client/react/provider.mdx
@@ -32,6 +32,8 @@ function App() {
| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |
| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |
| `version` | `string` | `undefined` | Your application version |
+| `ignoreErrors` | `Array<string \| RegExp>` | `DEFAULT_IGNORE_PATTERNS` | Error patterns to ignore. Pass `[]` to capture all errors. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
+| `beforeCapture` | `(exception) => boolean` | `undefined` | Return `false` to suppress an error. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
## Example with Options
@@ -48,6 +50,19 @@ function App() {
</TracewayProvider>
```
+## Capture All Errors
+
+By default, 4xx HTTP errors, network errors, and timeouts are ignored. To capture everything:
+
+```jsx
+<TracewayProvider
+ connectionString="your-token@https://traceway.example.com/api/report"
+ options={{ ignoreErrors: [] }}
+>
+ <YourApp />
+</TracewayProvider>
+```
+
## Environment-Specific Setup
```jsx
diff --git a/docs/pages/client/svelte/context.mdx b/docs/pages/client/svelte/context.mdx
index 7c51097d..7972ce4f 100644
--- a/docs/pages/client/svelte/context.mdx
+++ b/docs/pages/client/svelte/context.mdx
@@ -41,6 +41,8 @@ Must be called during component initialization (not in an event handler):
| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |
| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |
| `version` | `string` | `undefined` | Your application version |
+| `ignoreErrors` | `Array<string \| RegExp>` | `DEFAULT_IGNORE_PATTERNS` | Error patterns to ignore. Pass `[]` to capture all errors. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
+| `beforeCapture` | `(exception) => boolean` | `undefined` | Return `false` to suppress an error. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
## getTraceway
diff --git a/docs/pages/client/vue/plugin.mdx b/docs/pages/client/vue/plugin.mdx
index ac59ebf7..833c656e 100644
--- a/docs/pages/client/vue/plugin.mdx
+++ b/docs/pages/client/vue/plugin.mdx
@@ -33,6 +33,8 @@ app.mount("#app");
| `debounceMs` | `number` | `1500` | Batch delay in milliseconds |
| `retryDelayMs` | `number` | `10000` | Retry delay for failed uploads |
| `version` | `string` | `undefined` | Your application version |
+| `ignoreErrors` | `Array<string \| RegExp>` | `DEFAULT_IGNORE_PATTERNS` | Error patterns to ignore. Pass `[]` to capture all errors. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
+| `beforeCapture` | `(exception) => boolean` | `undefined` | Return `false` to suppress an error. See [Error Filtering](/client/js-sdk/initialization#error-filtering) |
## Full Example
@@ -55,6 +57,19 @@ app.use(createTracewayPlugin({
app.mount("#app");
```
+## Capture All Errors
+
+By default, 4xx HTTP errors, network errors, and timeouts are ignored. To capture everything:
+
+```javascript
+app.use(createTracewayPlugin({
+ connectionString: "your-token@https://traceway.example.com/api/report",
+ options: {
+ ignoreErrors: [],
+ },
+}));
+```
+
## Automatic Error Handling
The plugin automatically installs `app.config.errorHandler` to capture:
diff --git a/docs/theme.config.jsx b/docs/theme.config.jsx
index a56c4b9f..55b4ffde 100644
--- a/docs/theme.config.jsx
+++ b/docs/theme.config.jsx
@@ -14,11 +14,12 @@ const SDK_VISIBILITY = {
sdk: "go-",
"node-sdk": "js-node",
nestjs: "js-nestjs",
+ hono: "js-hono",
react: "js-react",
vue: "js-vue",
svelte: "js-svelte",
jquery: "js-jquery",
- "js-sdk": "js-",
+ "js-sdk": ["js-react", "js-vue", "js-svelte", "js-jquery", "js-generic"],
openrouter: "openrouter",
otel: "otel",
cloudflare: "cloudflare",
@@ -102,9 +103,14 @@ export default {
function SdkGuard({ requiredSdk, children }) {
const { sdk } = useSdk();
- const visible = requiredSdk.endsWith("-")
- ? sdk.startsWith(requiredSdk)
- : sdk === requiredSdk;
+ let visible;
+ if (Array.isArray(requiredSdk)) {
+ visible = requiredSdk.includes(sdk);
+ } else if (requiredSdk.endsWith("-")) {
+ visible = sdk.startsWith(requiredSdk);
+ } else {
+ visible = sdk === requiredSdk;
+ }
if (!visible) {
return <HiddenItem />;
}