tryError Documentation

Interface: CreateErrorOptions\<T\>
Interface

Defined in: [errors.ts:66](https://github.com/oconnorjohnson/try-error/blob/e3ae0308069a4fba073f4543d527ad76373db795/src/errors.ts#L66) Options for creating a TryError

tryError API Documentation v0.0.1-alpha.1


tryError API Documentation / CreateErrorOptions

Interface: CreateErrorOptions<T>

Defined in: errors.ts:66

Options for creating a TryError

Type Parameters

T

T extends string = string

Properties

captureStackTrace?

optional captureStackTrace: boolean;

Defined in: errors.ts:108

Whether to capture stack trace for this specific error Overrides global configuration


cause?

optional cause: unknown;

Defined in: errors.ts:85

The original error or thrown value that caused this error


context?

optional context: Record<string, unknown>;

Defined in: errors.ts:80

Additional context data for debugging


message

message: string;

Defined in: errors.ts:75

Human-readable error message


source?

optional source: string;

Defined in: errors.ts:90

Override the automatically detected source location


stackOffset?

optional stackOffset: number;

Defined in: errors.ts:102

Stack offset for source location detection Useful when wrapping error creation in utility functions

Default

3;

timestamp?

optional timestamp: number;

Defined in: errors.ts:95

Override the automatically generated timestamp


type

type: T;

Defined in: errors.ts:70

The error type - used for discriminated unions