# errorhandling

> module for server side error handling

Latest version **6.2.0** (published 2017-11-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install errorhandling
pnpm add errorhandling
yarn add errorhandling
bun add errorhandling
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 6.2.0 |
| Published | 2017-11-09 |
| First published | 2017-02-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shiwani |
| Maintainers | shiwani |

## Links

- npm: https://www.npmjs.com/package/errorhandling
- npm.io page: https://npm.io/package/errorhandling

## Dependencies (4)

- [chai](https://npm.io/package/chai.md) ^3.5.0
- [mocha](https://npm.io/package/mocha.md) ^3.2.0
- [istanbul](https://npm.io/package/istanbul.md) ^0.4.5
- [chai-http](https://npm.io/package/chai-http.md) ^3.0.0

## Recent versions

- 6.2.0 (latest) — 2017-11-09
- 6.1.0 — 2017-07-05
- 6.0.0 — 2017-06-28
- 5.20.0 — 2017-04-21
- 5.19.0 — 2017-04-21
- 5.18.0 — 2017-04-20
- 5.17.0 — 2017-04-11
- 5.16.0 — 2017-03-23
- 5.14.1 — 2017-03-23
- 5.15.0 — 2017-03-10
- 5.14.0 — 2017-03-10
- 5.13.0 — 2017-03-10
- 5.12.0 — 2017-03-10
- 5.11.0 — 2017-03-07
- 5.10.0 — 2017-03-02
- … 13 more at https://npm.io/package/errorhandling/versions

## README

# Error Handling Module

Common module to create error response object at server side

## List of all constant error codes


* Sequelize error code series starts from 1001
* Cassandra error code series starts from 2001
* Unknown error code series starts from 3001
* Business logic error code series starts from 5001
* Internal error code series starts from 7001


###### 1) constants.SUCCESS
###### 2) constants.CREATED
###### 3) constants.SEQUELIZE_DATABASE_ERROR
###### 4) constants.SEQUELIZE_VALIDATION_ERROR
###### 5) constants.CASSANDRA_DATABASE_ERROR
###### 6) constants.CASSANDRA_VALIDATION_ERROR
###### 7) constants.UNDEFINED_DATABASE_ERROR
###### 8) constants.UNDEFINED_ERROR
###### 9) constants.USER_DUPLICATION_ERROR
###### 10) constants.INVALID_JSON_OBJECT
###### 11) constants.USER_NOT_FOUND
###### 12) constants.COMPARE_PASSWORD_ERROR
###### 13) constants.PASSWORD_NOT_MATCH
###### 14) constants.VALID_CREDENTIALS
###### 15) constants.EMAIL_ALREADY_EXIST
###### 16) constants.INVALID_QUERY_PARAMETERS
###### 17) constants.ERROR_OCCURED_IN_GETTING_USER_LIST
###### 18) constants.UPDATE_DATA_ERROR
###### 19) constants.DELETE_DATA_ERROR
###### 20) constants.KEY_ALREADY_USED
###### 21) constants.ERROR_OCCURED_IN_GETTING_MASTER_LIST
###### 22) constants.SEQUELIZE_FOREIGN_KEY_CONSTRAINT_ERROR
###### 23) constants.ERROR_OCCURED_IN_GETTING_ECG_DATA

## Sample response
###### 1) Success Response
```json
{
  "code": "SS-200",
  "message": "Success",
  "data": [
    {
      "id": "204adf30-f444-11e6-bf17-574185f61676",
      "account": 1,      
      "ticket_id": null,
      "timestamp": "1486665020",
      "sensor_uuid": "1234",
      "ecgdata_status": null,
      "ticket_number": null,
      "patient_id": null
    }
  ]
}
```

###### 2) Error Response
```json
{
  "code": "US-1002",
  "message": "Sequelize validation failed",
  "error": {
    "name": "SequelizeValidationError",
    "message": "notNull Violation: first_name cannot be null",
    "errors": [
      {
        "message": "first_name cannot be null",
        "type": "notNull Violation",
        "path": "first_name",
        "value": null
      }
    ]
  }
}
```

## Commands to pubish npm module
###### 1) Login- 
        npm login    
###### 3) Publish npm module-
        npm publish
###### 4) Update existing npm module with new version-
        npm version [patch/minor/major]   
        npm publish      
###### 5) Update readme file for npm module-
        npm publish --update-readme
###### 5) Update package.json of app with new version-
        npm update --save

---
_Source: https://npm.io/package/errorhandling · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
