@terascope/utils / errors
errors
Index
Classes
Class | Description |
---|---|
TSError | A custom Error class with additional properties, like statusCode and fatalError |
Interfaces
Interface | Description |
---|---|
ElasticsearchError | - |
TSErrorConfig | - |
TSErrorContext | A simple object with any values |
Functions
getErrorStatusCode()
getErrorStatusCode(
err
,config
,defaultCode
):number
Parameters
Parameter | Type | Default value |
---|---|---|
err | unknown | undefined |
config | TSErrorConfig | {} |
defaultCode | number | DEFAULT_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
Parameter | Type |
---|---|
err | unknown |
Returns
string
Source
packages/utils/src/errors.ts:165
isElasticsearchError()
isElasticsearchError(
err
):err is ElasticsearchError
Check is a elasticsearch error
Parameters
Parameter | Type |
---|---|
err | unknown |
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
Parameter | Type |
---|---|
err | unknown |
Returns
err is Error
Source
packages/utils/src/errors.ts:381
isFatalError()
isFatalError(
err
):boolean
Parameters
Parameter | Type |
---|---|
err | unknown |
Returns
boolean
Source
packages/utils/src/errors.ts:372
isRetryableError()
isRetryableError(
err
):boolean
Parameters
Parameter | Type |
---|---|
err | unknown |
Returns
boolean
Source
packages/utils/src/errors.ts:376
isTSError()
isTSError(
err
):err is TSError
Check is a TSError
Parameters
Parameter | Type |
---|---|
err | unknown |
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
Parameter | Type |
---|---|
logger | Logger |
err | unknown |
...messages | any [] |
Returns
void
Source
packages/utils/src/errors.ts:232
parseError()
parseError(
input
,withStack
):string
parse input to get error message or stack
Parameters
Parameter | Type | Default value |
---|---|---|
input | unknown | undefined |
withStack | boolean | false |
Returns
string
Source
packages/utils/src/errors.ts:270
parseErrorInfo()
parseErrorInfo(
input
,config
):ErrorInfo
parse error for info
Parameters
Parameter | Type |
---|---|
input | unknown |
config | TSErrorConfig |
Returns
ErrorInfo
Source
packages/utils/src/errors.ts:177
prefixErrorMsg()
prefixErrorMsg(
input
,prefix
?,defaultMsg
?):string
Parameters
Parameter | Type | Default value |
---|---|---|
input | unknown | undefined |
prefix ? | string | undefined |
defaultMsg ? | string | 'Unknown Error' |
Returns
string
Source
packages/utils/src/errors.ts:360
stripErrorMessage()
stripErrorMessage(
error
,reason
,requireSafe
):string
Parameters
Parameter | Type | Default value |
---|---|---|
error | unknown | undefined |
reason | string | DEFAULT_ERR_MSG |
requireSafe | boolean | false |
Returns
string
Source
packages/utils/src/errors.ts:451
toStatusErrorCode()
toStatusErrorCode(
input
):string
Parameters
Parameter | Type |
---|---|
input | undefined | string |
Returns
string