Skip to main content

@terascope/utils / errors

errors

Index

Classes

ClassDescription
TSErrorA custom Error class with additional properties, like statusCode and fatalError

Interfaces

InterfaceDescription
ElasticsearchError-
TSErrorConfig-
TSErrorContextA simple object with any values

Functions

getErrorStatusCode()

getErrorStatusCode(err, config, defaultCode): number

Parameters

ParameterTypeDefault value
errunknownundefined
configTSErrorConfig{}
defaultCodenumberDEFAULT_STATUS_CODE

Returns

number

Source

packages/utils/src/errors.ts:430


getFullErrorStack()

getFullErrorStack(err): string

Use following the chain of caused by stack of an error. Don't use this when logging the error, only when sending it

Parameters

ParameterType
errunknown

Returns

string

Source

packages/utils/src/errors.ts:165


isElasticsearchError()

isElasticsearchError(err): err is ElasticsearchError

Check is a elasticsearch error

Parameters

ParameterType
errunknown

Returns

err is ElasticsearchError

Source

packages/utils/src/errors.ts:394


isError()

isError(err): err is Error

Check if an input has an error compatible api

Parameters

ParameterType
errunknown

Returns

err is Error

Source

packages/utils/src/errors.ts:381


isFatalError()

isFatalError(err): boolean

Parameters

ParameterType
errunknown

Returns

boolean

Source

packages/utils/src/errors.ts:372


isRetryableError()

isRetryableError(err): boolean

Parameters

ParameterType
errunknown

Returns

boolean

Source

packages/utils/src/errors.ts:376


isTSError()

isTSError(err): err is TSError

Check is a TSError

Parameters

ParameterType
errunknown

Returns

err is TSError

Source

packages/utils/src/errors.ts:386


logError()

logError(logger, err, ...messages): void

Safely log an error (with the error first Logger syntax)

Parameters

ParameterType
loggerLogger
errunknown
...messagesany[]

Returns

void

Source

packages/utils/src/errors.ts:232


parseError()

parseError(input, withStack): string

parse input to get error message or stack

Parameters

ParameterTypeDefault value
inputunknownundefined
withStackbooleanfalse

Returns

string

Source

packages/utils/src/errors.ts:270


parseErrorInfo()

parseErrorInfo(input, config): ErrorInfo

parse error for info

Parameters

ParameterType
inputunknown
configTSErrorConfig

Returns

ErrorInfo

Source

packages/utils/src/errors.ts:177


prefixErrorMsg()

prefixErrorMsg(input, prefix?, defaultMsg?): string

Parameters

ParameterTypeDefault value
inputunknownundefined
prefix?stringundefined
defaultMsg?string'Unknown Error'

Returns

string

Source

packages/utils/src/errors.ts:360


stripErrorMessage()

stripErrorMessage(error, reason, requireSafe): string

Parameters

ParameterTypeDefault value
errorunknownundefined
reasonstringDEFAULT_ERR_MSG
requireSafebooleanfalse

Returns

string

Source

packages/utils/src/errors.ts:451


toStatusErrorCode()

toStatusErrorCode(input): string

Parameters

ParameterType
inputundefined | string

Returns

string

Source

packages/utils/src/errors.ts:328