Octri

captureError

Reports an error, such as one your handler caught. The framework integrations call it for you on an unhandled error. Call it yourself for an error you catch and handle. The event is tagged octri.origin=server, and carries the environment and release from init.

Parameters

errorerrorrequired

The error. Its type, message and stack are sent. Anything that isn't an error is reported as one, with its text as the message.

traceTraceContext

The request's trace, from traceFromHeader. It links this event to the client SDK's error for the same request. A fresh trace is started without it.

methodstring

The HTTP method of the request that failed.

pathstring

Its path.

operationIdstring

Its operation, as your spec names it, so the issue sits under that endpoint.

statusCodenumber

The status your server answered with.

levelchoicedefault: error

error, fatal or warning.

Example

Node
import { captureError, traceFromHeader } from "@octri/node";

try {
  await chargeCard(order);
} catch (error) {
  captureError(error, {
    trace: traceFromHeader(req.headers.traceparent),
    method: "POST",
    path: "/orders",
    operationId: "createOrder",
    statusCode: 502,
  });
  throw error;
}

In each language

LanguageCall
NodecaptureError()
Pythonoctri.capture_error()
Gooctri.CaptureError()
RubyOctri.capture_error
JavaOctri.captureError()
KotlinOctri.captureError()
PHPOctri::captureError()
Rustoctri_monitoring::capture_error()
SwiftOctri.captureError()
DartOctri.captureError()