AuthenticationError class
General AuthenticationError
class to represent an Authentication error with a Code Status.
- Extends
-
Error
Constructors
Authentication |
Initializes a new instance of the AuthenticationError class. |
Properties
Error | |
status |
Inherited Properties
message | |
name | |
stack |
Methods
determine |
Used to determine a status code from the error message for non- |
is |
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
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.