Class: Errorme

Errorme

new Errorme()

Author:
Source:

Methods

getError(key, message) → {ErrormeError}

Returns error object based on the defined errors list
Parameters:
Name Type Description
key string The name (key) of error object or the error code inside [ERRORS] object
message string An optional parameter for describing the error
Author:
Source:
Returns:
Type
ErrormeError

getHttpError(key, message) → {httpError}

Returns http specific error object by the key name or the error code in [ERRORS] varant object
Parameters:
Name Type Description
key string The name (key) of error object or the error code inside [ERRORS] object
message string An optional parameter for describing the error
Author:
Source:
Returns:
Type
httpError

middleware(app)

Assign a function to errormeSend property of response object. The function errormeSend() is the following: errormeSend(error: ErrormeError, data: Object), if error exist then send the appropriate http error, otherwhise sends success with the provided data
Parameters:
Name Type Description
app function express middleware app
Author:
Source: