Skip to content

@vltpkg/output/error

Type Aliases

ErrorCause

type ErrorCause = Record<string, unknown> & object

Defined in: error.ts:3

Type declaration

cause?
optional cause: ErrorCause;

ParsedError

type ParsedError = object

Defined in: error.ts:7

Type declaration

Index Signature

[key: string]: unknown
cause?
optional cause:
| ErrorCause
| ParsedError;
message
message: string
name
name: string
stack?
optional stack: string;

Functions

asRootError()

function asRootError(
v,
match?,
): Omit<ParsedError, 'cause'> & Required<Pick<ParsedError, 'cause'>>

Defined in: error.ts:59

Find the root error from an unknown value and throw if one is not found.

Parameters

v

unknown

match?
code?

string

Returns

Omit<ParsedError, "cause"> & Required<Pick<ParsedError, "cause">>


findRootError()

function findRootError(v, match?): null | ParsedError

Defined in: error.ts:46

Find the root error from an unknown value, optionally matching a code.

Parameters

v

unknown

match?
code?

string

Returns

null | ParsedError


parseError()

function parseError(err): null | ParsedError

Defined in: error.ts:19

Parse an unknown value into an error. Will also take enumerable properties from legacy style Node errors and treat them as the cause.

Parameters

err

unknown

Returns

null | ParsedError