Skip to main content

Error Context Policy

Purpose

Standardize backend error log context fields so incidents can be filtered and triaged quickly in Cloudflare and LGTM dashboards.

Required Fields

  • requestId
  • path
  • method
  • status
  • code

Conditional Domain Fields

  • paymentId: when request path includes payment identifier (/api/v1/payments/status/:id)
  • customerId: when request path includes customer identifier (/api/v1/customers/:id, /api/v1/license/customer/:id)
  • licenseKey: when request path includes license verification key (/api/v1/license/verify/:key)

Rules

  1. Do not log secrets or raw tokens.
  2. Do not log full request bodies by default.
  3. Domain IDs must be logged only if extracted from trusted path parameters.
  4. Keep field names stable for dashboard and alert queries.

Event Names

  • request.error for handled application errors.
  • request.error.unhandled for uncaught errors.
  • domain.event for domain transitions/outbox-aligned events.