1.1.4 • Published 6 months ago

krrs-error-code-parser v1.1.4

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

error-code-parser

npm version

A utility npm package that parses error messages and extracts relevant information to generate a structured error object.

Installation

npm install krrs-error-code-parser

Usage

const errorCodeParser = require('error-code-parser');

const error = new Error('BAD_REQUEST Something not found');

const parsedError = errorCodeParser(error);

console.log(parsedError);

output: {
  code: 400,
  message: 'Something not found'
}

Supported Error Codes

BAD_REQUEST, BAD_REQUEST_TO_IGNORE = 400 NOT_FOUND = 404 CONFLICT = 422 FORBIDDEN = 403 UNPROCESSABLE = 422 default = 500

1.1.4

6 months ago

1.1.3

6 months ago

1.1.2

6 months ago

1.1.1

6 months ago

1.1.0

6 months ago