effect-io-ai

Package: effect
Module: Cause

Cause.reasonAnnotations

Reads the annotations from a single Reason as a Context.

When to use

Use when you need tracing metadata (e.g. StackTrace) from a specific reason rather than the whole cause.

Example (Reading reason annotations)

import { Cause, Context } from "effect"

class RequestId extends Context.Service<RequestId, string>()("RequestId") {}

const reason = Cause.makeFailReason("error")
const annotated = reason.annotate(Context.make(RequestId, "req-1"))

console.log(Context.getOrUndefined(Cause.reasonAnnotations(annotated), RequestId)) // "req-1"

See

Signature

declare const reasonAnnotations: <E>(self: Reason<E>) => Context.Context<never>

Source

Since v4.0.0