Skip to Content
Hydra@exodus/errors

@exodus/errors

Version: 0.0.0

SafeError

class

Constructor

constructor
SafeError(__namedParameters: any): SafeError

Parameters:

__namedParameters: any

Returns:

SafeError

Methods

toJSON
toJSON(): SafeErrorJSON
from
from(err: T, depth?: number): SafeError

Parameters:

err: T
depth (optional): number

Returns:

SafeError

Accessors

code
hint
linkedErrors
name
stack
stackFrames
timestamp

SafeCode

type

SafeContextType

type

SafeErrorJSON

type

Properties

linkedErrors?
stack?
string
timestamp
number

SafeName

type

SafeString

type

MAX_LINKED_ERRORS_DEPTH

variable

Type

5

SafeContext

variable

Type

const SafeContext: { getSchema: { ... } }

sanitizeErrorMessage

variable

Type

const sanitizeErrorMessage: (message: string) => string

Signature

__type(message: string): string

Parameters:

message: string

Returns:

string

captureStackTrace

function

Signature

captureStackTrace(err: Error): void

Parameters:

err: Error

Returns:

void

parseStackTrace

function

Signature

parseStackTrace(err: Error): undefined | Frame[]
If this function returns undefined, that likely means `error.stack` has been already accessed. Consider calling `captureStackTrace` first to capture the customized stack trace, e.g., ```ts captureStackTrace(error) console.log(error.stack) ... const safeError = SafeError.from(error) // Works even if `error.stack` has been accessed. ```

Parameters:

err: Error

Returns:

undefined | Frame[]

Frame

type

Properties

async?
boolean | null
column?
number | null
file?
string | null
function?
string | null
in_app?
boolean | null
line?
number | null
method?
string | null
toplevel?
boolean | null

SafeError

class

Constructor

constructor
SafeError(__namedParameters: any): SafeError

Parameters:

__namedParameters: any

Returns:

SafeError

Methods

toJSON
toJSON(): SafeErrorJSON
from
from(err: T, depth: number): SafeError

Parameters:

err: T
depth: number

Returns:

SafeError

Accessors

code
hint
linkedErrors
name
stack
stackFrames
timestamp

SafeCode

type

SafeContextType

type

SafeErrorJSON

type

Properties

linkedErrors?
stack?
string
timestamp
number

SafeName

type

SafeString

type

MAX_LINKED_ERRORS_DEPTH

variable

Type

5

SafeContext

variable

Type

const SafeContext: { getSchema: { ... } }

captureStackTrace

function

Signature

captureStackTrace(err: Error): void

Parameters:

err: Error

Returns:

void

parseStackTrace

function

Signature

parseStackTrace(err: Error): undefined | Frame[]
If this function returns undefined, that likely means `error.stack` has been already accessed. Consider calling `captureStackTrace` first to capture the customized stack trace, e.g., ```ts captureStackTrace(error) console.log(error.stack) ... const safeError = SafeError.from(error) // Works even if `error.stack` has been accessed. ```

Parameters:

err: Error

Returns:

undefined | Frame[]

sanitizeErrorMessage

function

Signature

sanitizeErrorMessage(message: string): string

Parameters:

message: string

Returns:

string

Frame

type

Properties

async?
boolean | null
column?
number | null
file?
string | null
function?
string | null
in_app?
boolean | null
line?
number | null
method?
string | null
toplevel?
boolean | null

Start building

XO

Request Demo

Schedule a call with our team

Select a product
Arrow right

Start building
Grateful

Contact Us

We're here to help