Steplix Http Exception
npm install steplix-http-exceptionSteplix Http Exception.
* [Download & Install][install].
* [How is it used?][how_is_it_used].
* [Tests][tests].
bash
$ npm install steplix-http-exception
`$3
`bash
$ git clone https://github.com/steplix/SteplixHttpException.git
$ cd SteplixHttpException
$ npm install
`How is it used?
`js
'use strict';const { Errors } = require('steplix-http-exception');
// ...
throw new Errors.NotFound();
``js
// 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 :)
$3
`sh
npm test
`$3
`sh
npm run test-app
``
[install]: #download--install
[how_is_it_used]: #how-is-it-used
[tests]: #tests