> ## Documentation Index
> Fetch the complete documentation index at: https://sentrydocs.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Monitoring

> Capture and triage errors with full context

Error Monitoring is the core of Sentry. Every time your application throws an exception or logs an error, Sentry captures it with full context — the stack trace, the user who was affected, the sequence of events that led up to it, and more. You stop guessing and start fixing.

## What Sentry captures

When an error occurs, Sentry records:

* **Exceptions** — both unhandled crashes and exceptions you explicitly capture
* **Stack traces** — with source code context around each frame
* **Breadcrumbs** — a timeline of events (navigation, HTTP requests, console logs) that led to the error
* **User context** — who was affected, including ID, email, and username
* **Tags and custom context** — any additional data you attach at capture time
* **Release and environment** — which version of your app was running and in which environment

## Instrumenting your code

Use the Sentry SDK to capture errors and attach context.

<CodeGroup>
  ```javascript JavaScript theme={null}
  import * as Sentry from "@sentry/browser";

  // Capture an exception
  try {
    riskyOperation();
  } catch (error) {
    Sentry.captureException(error);
  }

  // Identify the current user
  Sentry.setUser({
    id: "user-123",
    email: "jane@example.com",
    username: "jane",
  });

  // Add a breadcrumb manually
  Sentry.addBreadcrumb({
    category: "auth",
    message: "User logged in",
    level: "info",
  });
  ```

  ```python Python theme={null}
  import sentry_sdk

  # Capture an exception
  try:
      risky_operation()
  except Exception as e:
      sentry_sdk.capture_exception(e)

  # Identify the current user
  sentry_sdk.set_user({
      "id": "user-123",
      "email": "jane@example.com",
      "username": "jane",
  })

  # Add a breadcrumb manually
  sentry_sdk.add_breadcrumb(
      category="auth",
      message="User logged in",
      level="info",
  )
  ```
</CodeGroup>

<Note>
  Most SDKs automatically capture unhandled exceptions without any extra code. Manual `captureException` calls are for errors you catch yourself but still want to track.
</Note>

## Stack traces with source context

Sentry displays the full call stack at the time of the error. Each frame shows the file, line number, and surrounding source code — so you can see exactly what was executing.

If you upload **source maps** (for JavaScript) or configure **debug symbols** (for native apps), Sentry maps minified or compiled frames back to your original source code.

## Breadcrumbs

Breadcrumbs are a trail of events that happened before the error. Sentry automatically records:

* Navigation events (page changes, route transitions)
* HTTP requests and their status codes
* Console log output
* UI interactions (clicks, form submissions)
* Prior errors and exceptions

You can also add your own breadcrumbs at any point using `addBreadcrumb` / `add_breadcrumb`.

## User context

Attach a user to the current scope so Sentry can tell you how many unique users were affected by an issue. You can include any of these fields:

| Field        | Description                                  |
| ------------ | -------------------------------------------- |
| `id`         | A unique identifier for the user             |
| `email`      | The user's email address                     |
| `username`   | A display name or handle                     |
| `ip_address` | Set to `"{{auto}}"` to capture automatically |

## Tags and custom context

Tags are key-value pairs you can search and filter by. Custom context lets you attach structured data (like a JSON object) that appears in the issue detail.

<CodeGroup>
  ```javascript JavaScript theme={null}
  Sentry.setTag("payment_method", "credit_card");

  Sentry.setContext("checkout", {
    cart_id: "abc-123",
    item_count: 5,
    total: 99.99,
  });
  ```

  ```python Python theme={null}
  sentry_sdk.set_tag("payment_method", "credit_card")

  sentry_sdk.set_context("checkout", {
      "cart_id": "abc-123",
      "item_count": 5,
      "total": 99.99,
  })
  ```
</CodeGroup>

## Issue grouping

Sentry groups similar errors into a single **issue** so your inbox doesn't fill up with thousands of individual events. Grouping uses a **fingerprint** derived from the stack trace and error type.

You can customize grouping by:

* Setting a custom `fingerprint` on the event
* Using **stack trace rules** in your project settings to ignore specific frames
* Merging issues manually in the UI

## Suggested fixes with Sentry AI (Seer)

For issues with enough event history, Sentry's AI feature **Seer** analyzes the error, your stack trace, and your codebase to suggest a root cause and a potential fix. Look for the **"Fix with Seer"** button on any issue detail page.

<Tip>
  Seer works best when you've connected your source code repository to Sentry. Go to **Settings > Integrations** to link GitHub, GitLab, or Bitbucket.
</Tip>

## Viewing and triaging issues

Navigate to the **Issues** section in your Sentry project to see all captured errors. From there you can:

* **Filter** by environment, release, user, tag, or date range
* **Search** using Sentry's query syntax (e.g. `is:unresolved user.email:jane@example.com`)
* **Assign** issues to teammates or teams
* **Resolve** issues when a fix is deployed
* **Ignore** issues that are known and acceptable

<CardGroup cols={2}>
  <Card title="Source Maps" icon="map">
    Upload source maps to see original JavaScript source in stack traces instead of minified code.
  </Card>

  <Card title="Releases" icon="tag">
    Tag errors with your release version to track which deploy introduced a regression.
  </Card>

  <Card title="Alerts" icon="bell">
    Set up alert rules to get notified in Slack, email, or PagerDuty when error rates spike.
  </Card>

  <Card title="Ownership Rules" icon="user">
    Route issues automatically to the right team based on file paths or URL patterns.
  </Card>
</CardGroup>
