npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

errorhandling

v6.2.0

Published

module for server side error handling

Downloads

10

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