steplix-http-exception

0.0.4 • Public • Published

Steplix Http Exception

Steplix Http Exception.

Index

Download & Install

NPM

$ npm install steplix-http-exception

Source code

$ git clone https://github.com/steplix/SteplixHttpException.git
cd SteplixHttpException
$ npm install

How is it used?

'use strict';
 
const { Errors } = require('steplix-http-exception');
// ...
throw new Errors.NotFound();
// All HTTP Status Code are an Exception
const e = new Errors.NotFound('My custom message', {hello: 'world'});
// ...
console.log(e.toJson());
// { "error": 'My custom message', "code": 404, "extra": { "hello": "world" } }

Tests

In order to see more concrete examples, I INVITE YOU TO LOOK AT THE TESTS :)

Run the unit tests

npm test

Run an application (server) with a more formal example.

npm run test-app

Readme

Keywords

Package Sidebar

Install

npm i steplix-http-exception

Weekly Downloads

72

Version

0.0.4

License

ISC

Unpacked Size

22.8 kB

Total Files

9

Last publish

Collaborators

  • fgrennon
  • dev-steplix
  • nicolas-steplix
  • alejandro-steplix