Skip to main content

Overview

recordSpanException() records an error or exception on the currently active span, making it visible in the Keywords AI dashboard for debugging.

Signature

Basic Usage

With Status Update

Multiple Exception Tracking

Retry Logic with Exception Tracking

Custom Error Context

Graceful Degradation

With User Notification

Parameters

Error | unknown
required
The error or exception object to record

Recorded Information

The exception recording captures:
  • Error message
  • Error type/name
  • Stack trace
  • Timestamp

Best Practices

  • Always record exceptions before re-throwing them
  • Combine with updateCurrentSpan() to set status to ERROR
  • Add context attributes before recording for better debugging
  • Record all errors, even if you handle them gracefully
  • Include trace IDs in user-facing error messages for support
  • Exception details are visible in the Keywords AI dashboard
  • Only call within an active span