3.0.0 • Published 9 years ago
errorcode v3.0.0
errorcode
Translate error messages to errorcodes.
API Reference
Function to add status field to an error to be used with express.
errorcode~add(status, error) ⇒ Error
Deprecated
Add the status to an error.
Kind: inner method of errorcode
Returns: Error - error with the status.
Throws:
- Error when missing any argument.
Param | Type | Description |
---|---|---|
status | number | http status code. |
error | Error | the error which the status will be appended. |
errorcode~register(object)
Adds the current object to the dictionary
Kind: inner method of errorcode
Param | Type | Description |
---|---|---|
object | object | mapping a message to an errorcode |
errorcode~get(error)
Gets the error code for the first word of the error message or 500
Kind: inner method of errorcode
Param | Type | Description |
---|---|---|
error | object | with message |