errorcode

3.0.0 • Public • Published

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

Package Sidebar

Install

npm i errorcode

Weekly Downloads

2

Version

3.0.0

License

MIT

Last publish

Collaborators

  • aronrodrigues