JSPM

error-naturals

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q27552F
  • License MIT

Package Exports

  • error-naturals

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (error-naturals) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

error-naturals NPM version Build Status Dependency Status

Installation

$ npm install --save error-naturals
$ yarn add error-naturals

Usage

const ErrorNaturals = require('error-naturals');
const path = require('path');

const errorNaturals = new ErrorNaturals(path.join(__dirname, PATH_TO_YOUR_ERROR_CONFIG_JSON_FILE ));

errorNaturals.generateErrors(errorCode,errorType,customMessage, customResponse);

Error config json file

You need to create a json file in the following format.

{
  "YOUR_ERROR_CODE": {
    "error": {
      "meta": {
        "type": "error",
        "status": 400,
        "code": "INVALID_REQUEST",
        "context_info": {
          "ping": {
            "message": "A ping request was made without revelant content"
          }
        },
        "help_url": "http://developers.hootboard.com/docs/#errors",
        "message": "A ping request was made without one or more required parameters"
      }
    }
  }
}

License

MIT © soorajvnair