dmx-error-handler-poc

0.1.0 • Public • Published

dmx-error-handler-poc

Custom Error Handler for Microservices

Create descriptive errors for APIs.

Currenlty supporting preconfigured messages for the following error codes:

Error Code Default
200 OK
201 Created
304 Not Modified
400 Bad Request
401 Unauthorized
403 Forbidden
500 Internal Server Error

Installation

npm install
npm start
  1. Navigate to http://localhost:3000 to begin seeing custom error messages

Watchlist Setup

The error handler currently loads custom error messages from lib/watch.list (a CSV file) during initialization.

Sample format for Dealer retrieval:

/dealer, 304, Dealer Account Not Update
/dealer, 400, Dealer ID is missing
/dealer, 401, Unauthorized Dealer

Field Description

Endpoint Status Code Custom Message
/dealer 304 Dealer Account Not Updated
/dealer 400 Dealer ID is missing
/dealer 401 Unauthorized Dealer

Todos:

  • Modularize the error handler
  • Create automated unit tests
  • Support endpoints with wildcards

Package Sidebar

Install

npm i dmx-error-handler-poc

Weekly Downloads

1

Version

0.1.0

License

UNLICENSED

Last publish

Collaborators

  • ccowell