errorhandling
module for server side error handling
Last updated a year ago by shiwani .
ISC · Original npm · Tarball · package.json
$ cnpm install errorhandling 
SYNC missed versions from official npm registry.

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
{
  "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
{
  "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   

Current Tags

  • 6.2.0                                ...           latest (a year ago)

28 Versions

  • 6.2.0                                ...           a year ago
  • 6.1.0                                ...           2 years ago
  • 6.0.0                                ...           2 years ago
  • 5.20.0                                ...           2 years ago
  • 5.19.0                                ...           2 years ago
  • 5.18.0                                ...           2 years ago
  • 5.17.0                                ...           2 years ago
  • 5.16.0                                ...           2 years ago
  • 5.14.1                                ...           2 years ago
  • 5.15.0                                ...           2 years ago
  • 5.14.0                                ...           2 years ago
  • 5.13.0                                ...           2 years ago
  • 5.12.0                                ...           2 years ago
  • 5.11.0                                ...           2 years ago
  • 5.10.0                                ...           2 years ago
  • 5.8.0                                ...           2 years ago
  • 5.7.0                                ...           2 years ago
  • 5.6.3                                ...           2 years ago
  • 5.6.2                                ...           2 years ago
  • 5.4.0                                ...           2 years ago
  • 5.3.0                                ...           2 years ago
  • 5.2.0                                ...           2 years ago
  • 5.1.0                                ...           2 years ago
  • 5.0.0                                ...           2 years ago
  • 4.0.0                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 29
Last Day 0
Last Week 0
Last Month 84
Dependencies (4)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |