https://github.com/steplix/steplixhttpexception
Steplix Http Exception
https://github.com/steplix/steplixhttpexception
error exception package status-codes
Last synced: 3 months ago
JSON representation
Steplix Http Exception
- Host: GitHub
- URL: https://github.com/steplix/steplixhttpexception
- Owner: steplix
- Created: 2020-01-24T05:22:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T01:13:08.000Z (almost 3 years ago)
- Last Synced: 2025-09-27T10:57:30.261Z (4 months ago)
- Topics: error, exception, package, status-codes
- Language: JavaScript
- Homepage:
- Size: 338 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Steplix Http Exception
Steplix Http Exception.
## Index
* [Download & Install][install].
* [How is it used?][how_is_it_used].
* [Tests][tests].
## Download & Install
### NPM
```bash
$ npm install steplix-http-exception
```
### Source code
```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 :)**
### Run the unit tests
```sh
npm test
```
### Run an application (server) with a more formal example.
```sh
npm run test-app
```
[install]: #download--install
[how_is_it_used]: #how-is-it-used
[tests]: #tests