# Story 6.2: Error Reporting (Sentry)

## Metadata
- **Story ID**: 6.2
- **Title**: Error Reporting (Sentry)
- **Epic**: 6 - Observability & Production Readiness
- **Status**: Pending
- **Priority**: High
- **Estimated Time**: 4-5 hours
- **Dependencies**: 1.4

## Goal
Add comprehensive error reporting with Sentry integration that captures errors with full context.

## Description
This story integrates Sentry for error reporting, sending all errors from the error bus to Sentry with complete context including trace IDs, user information, and module context.

## Deliverables

### 1. Sentry Integration
- Install and configure Sentry SDK
- Integrate with error bus:
  - Send errors to Sentry
  - Include trace ID in Sentry events
  - Add user context (user ID, email)
  - Add module context (module name)
- Sentry middleware:
  - Capture panics
  - Capture HTTP errors (4xx, 5xx)
- Configure Sentry DSN via config

### 2. Error Context Enhancement
- Enrich errors with:
  - Request context
  - User information
  - Module information
  - Stack traces
  - Environment information

## Acceptance Criteria
- [ ] Errors are reported to Sentry with context
- [ ] Panics are captured and reported
- [ ] HTTP errors are captured
- [ ] Trace IDs are included in Sentry events
- [ ] User context is included
- [ ] Sentry DSN is configurable

## Files to Create/Modify
- `internal/errorbus/sentry_bus.go` - Sentry integration
- `internal/server/middleware.go` - Sentry middleware
- `internal/di/providers.go` - Add Sentry provider
- `config/default.yaml` - Add Sentry config

