Skip to main content

Function: recordSpanError()

recordSpanError(error, message?): void

Defined in: src/observability/tracer.ts:145

Records an error on the currently active span.

Parameters​

error​

Error

Error to record

message?​

string

Optional additional message

Returns​

void

Remarks​

Records the error as an exception event and sets span status to ERROR. Does nothing if no span is active.

Example​

try {
await riskyOperation();
} catch (error) {
recordSpanError(error as Error, 'Failed to complete operation');
throw error;
}

Since​

0.1.0