Function
capture
(obj: E & object, span: Option.Option<Tracer.Span>)
Source from the content-addressed store, hash-verified
| 666 | |
| 667 | /* @internal */ |
| 668 | export const capture = <E>(obj: E & object, span: Option.Option<Tracer.Span>): E => { |
| 669 | if (Option.isSome(span)) { |
| 670 | return new Proxy(obj, { |
| 671 | has(target, p) { |
| 672 | return p === internalCause.spanSymbol || p === originalSymbol || p in target |
| 673 | }, |
| 674 | get(target, p) { |
| 675 | if (p === internalCause.spanSymbol) { |
| 676 | return span.value |
| 677 | } |
| 678 | if (p === originalSymbol) { |
| 679 | return obj |
| 680 | } |
| 681 | // @ts-expect-error |
| 682 | return target[p] |
| 683 | } |
| 684 | }) |
| 685 | } |
| 686 | return obj |
| 687 | } |
| 688 | |
| 689 | /* @internal */ |
| 690 | export const die = (defect: unknown): Effect.Effect<never> => |
Tested by
no test coverage detected