AuthenticationError class

General AuthenticationError class to represent an Authentication error with a Code Status.

Extends

Error

Constructors

AuthenticationError(string, StatusCode)

Initializes a new instance of the AuthenticationError class.

Properties

Error
statusCode

Inherited Properties

message
name
stack

Methods

determineStatusCodeAndBuildMessage(any)

Used to determine a status code from the error message for non-IStatusCodeError's.

isStatusCodeError(any)

Corroborates that the error is of type IStatusCodeError.

Constructor Details

AuthenticationError(string, StatusCode)

Initializes a new instance of the AuthenticationError class.

new AuthenticationError(message: string, statusCode: StatusCode)

Parameters

message

string

The Error message.

statusCode
StatusCode

The StatusCode number to use.

Property Details

Error

static Error: ErrorConstructor

Property Value

ErrorConstructor

statusCode

statusCode: StatusCode

Property Value

Inherited Property Details

message

message: string

Property Value

string

Inherited From Error.message

name

name: string

Property Value

string

Inherited From Error.name

stack

stack?: string

Property Value

string

Inherited From Error.stack

Method Details

determineStatusCodeAndBuildMessage(any)

Used to determine a status code from the error message for non-IStatusCodeError's.

static function determineStatusCodeAndBuildMessage(err: any): string

Parameters

err

any

The error thrown, used to determine an appropriate status code.

Returns

string

The error message to be sent as a response.

isStatusCodeError(any)

Corroborates that the error is of type IStatusCodeError.

static function isStatusCodeError(err: any): boolean

Parameters

err

any

The error to validate.

Returns

boolean

If err is an IStatusCodeError, the result is true; otherwise false.