https://github.com/amkjs/amk-error
http response error object for amkjs
https://github.com/amkjs/amk-error
amkjs error-handling http-errors
Last synced: 8 months ago
JSON representation
http response error object for amkjs
- Host: GitHub
- URL: https://github.com/amkjs/amk-error
- Owner: amkjs
- License: mit
- Created: 2017-09-17T11:35:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-07T04:03:07.000Z (over 7 years ago)
- Last Synced: 2025-04-12T22:49:10.958Z (9 months ago)
- Topics: amkjs, error-handling, http-errors
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AMK-ERROR
[](https://circleci.com/gh/amkjs/amk-error)
[](https://codecov.io/gh/amkjs/amk-error)
[](https://snyk.io/test/github/amkjs/amk-error?targetFile=package.json)
http response error object for amk js
## Usage
to install: `npm i amk-error`
to use:
```
const ErrorObject = require('amk-error');
throw new ErrorObject('Not found', 404);
```
## API
#### ```constructor(message, status)```
---
Creating an error object
##### Arguments
* **message** **_(string)_** - message regarding the error (default: Something went wrong)
* **status** **_(number)_** - http status code, will only accept 400 to 599. (default is 500)
## Tests
1. install dependencies using `npm install`
2. run `npm test`
## Feedback
All bugs, feature requests, pull requests, feedback, etc., are welcome. [Create an issue](https://github.com/amkjs/amk-error/issues).
## License
[MIT](https://github.com/amkjs/amk-error/blob/master/LICENSE)