Package com.tnsai.observability.errors


package com.tnsai.observability.errors
Structured error reporting infrastructure.

One ErrorReport per error occurrence, dedup-able by stable ErrorFingerprint, classified by ErrorCategory, with a flat CauseInfo chain.

Builders: ErrorEmitter.from(Throwable) pre-populates everything derivable from the throwable; caller fills classification + attributes.

Stack-trace normalization (StackTraceNormalizer) strips lambda hashes and proxy suffixes so the same code path produces the same digest across JVM restarts. Fingerprints stay stable across hosts.

Correlation: every report optionally carries the EventContext that was active at throw time (tenant / session / agent / role / trace), captured automatically via AgentContext.

Defensive helper: TnsAIException.wrap(Throwable) normalizes arbitrary third-party throwables into the framework's exception hierarchy with best-effort retryable classification.

Out of scope for this PR (follow-ups):

  • Sink layer (ErrorReportPublisher) — Prometheus metrics, Sentry/Rollbar adapters, Alertmanager rules.
  • Recovery action tracking integration with ResilienceExecutor / @Resilience.
  • relatedEventIds populated from a session event buffer.
  • Redaction integration (#80) for messages and stack traces.
  • Migration: rewire framework logger.error(..., e) call sites.
Since:
0.5.0 (issue #86)