Type Aliases
ErrorCause
type ErrorCause = Record<string, unknown> & objectDefined in: error.ts:3
Type declaration
cause?
optional cause: ErrorCause;ParsedError
type ParsedError = objectDefined in: error.ts:7
Type declaration
Index Signature
[key: string]: unknowncause?
optional cause: | ErrorCause | ParsedError;message
message: stringname
name: stringstack?
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 | ParsedErrorDefined 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 | ParsedErrorDefined 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