aisbreaker-api-js - v0.1.15 / api/AIsError / AIsError
Class: AIsError
api/AIsError.AIsError
Error class to be able to easily forward HTTP errors and error codes via the (network) AIsBreaker API to the actual client.
Hierarchy
Error↳
AIsError
Implements
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new AIsError(message, statusCode, statusText?)
Parameters
| Name | Type |
|---|---|
message | string |
statusCode | number |
statusText? | string |
Overrides
Error.constructor
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:38
Properties
message
• message: string
Implementation of
Inherited from
Error.message
Defined in
aisbreaker.org/node_modules/typescript/lib/lib.es5.d.ts:1068
name
• name: string
Inherited from
Error.name
Defined in
aisbreaker.org/node_modules/typescript/lib/lib.es5.d.ts:1067
stack
• Optional stack: string
Inherited from
Error.stack
Defined in
aisbreaker.org/node_modules/typescript/lib/lib.es5.d.ts:1069
statusCode
• statusCode: number
Implementation of
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:35
statusText
• Optional statusText: string
Implementation of
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:36
prepareStackTrace
▪ Static Optional prepareStackTrace: (err: Error, stackTraces: CallSite[]) => any
Type declaration
▸ (err, stackTraces): any
Optional override for formatting stack traces
Parameters
| Name | Type |
|---|---|
err | Error |
stackTraces | CallSite[] |
Returns
any
See
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
Inherited from
Error.prepareStackTrace
Defined in
aisbreaker-js/node_modules/@types/node/globals.d.ts:11
stackTraceLimit
▪ Static stackTraceLimit: number
Inherited from
Error.stackTraceLimit
Defined in
aisbreaker-js/node_modules/@types/node/globals.d.ts:13
Methods
getErrorObject
▸ getErrorObject(): Object
Returns
Object
| Name | Type |
|---|---|
error | { message: string ; statusCode: number ; statusText?: string } |
error.message | string |
error.statusCode | number |
error.statusText? | string |
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:72
getObject
▸ getObject(): Object
Returns
Object
| Name | Type |
|---|---|
message | string |
statusCode | number |
statusText? | string |
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:64
captureStackTrace
▸ Static captureStackTrace(targetObject, constructorOpt?): void
Create .stack property on a target object
Parameters
| Name | Type |
|---|---|
targetObject | object |
constructorOpt? | Function |
Returns
void
Inherited from
Error.captureStackTrace
Defined in
aisbreaker-js/node_modules/@types/node/globals.d.ts:4
fromAIsErrorData
▸ Static fromAIsErrorData(data): AIsError
Parameters
| Name | Type |
|---|---|
data | AIsErrorData |
Returns
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:144
fromError
▸ Static fromError(error, statusCode, context?): AIsError
Convert existing Error into AIsError
Parameters
| Name | Type | Description |
|---|---|---|
error | Error | |
statusCode | number | - |
context? | string | optional context information/description/message prefix for error message |
Returns
AIsError
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:139
fromHTTPError
▸ Static fromHTTPError(httpError, context?): AIsError
Convert existing (ky) HttpError into AIsError
Parameters
| Name | Type | Description |
|---|---|---|
httpError | HTTPError | |
context? | string | optional context information/description/message prefix for error message |
Returns
AIsError
Defined in
aisbreaker-js/packages/aisbreaker-api-js/src/api/AIsError.ts:86