error
Type Aliases
ErrorCause
type ErrorCause = Record<string, unknown> & object;Defined in: error.ts:3
Type declaration
| Name | Type |
|---|---|
cause? | ErrorCause |
ParsedError
type ParsedError = object;Defined in: error.ts:7
Type declaration
Index Signature
[key: string]: unknown| Name | Type |
|---|---|
cause? | | ErrorCause | ParsedError |
message | string |
name | string |
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
| Parameter | Type |
|---|---|
v | unknown |
match? | { code: string; } |
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
| Parameter | Type |
|---|---|
v | unknown |
match? | { code: string; } |
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
| Parameter | Type |
|---|---|
err | unknown |
Returns
null | ParsedError