https://github.com/cludden/mycro-error
generic error handling service for mycro apps
https://github.com/cludden/mycro-error
Last synced: over 1 year ago
JSON representation
generic error handling service for mycro apps
- Host: GitHub
- URL: https://github.com/cludden/mycro-error
- Owner: cludden
- License: mit
- Created: 2016-02-25T21:38:43.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-08-08T21:02:54.000Z (almost 10 years ago)
- Last Synced: 2025-02-14T10:18:00.613Z (over 1 year ago)
- Language: JavaScript
- Size: 49.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# mycro-error
an [errlich](https://github.com/cludden/errlich) hook for [mycro](https://github.com/cludden/mycro) apps.
## Installing
install
```bash
npm install --save mycro-error
```
add to hooks
```javascript
// in config/hooks.js
module.exports = {
// ..
'mycro-error',
// ..
}
```
## Configure
define configuration file.
```javascript
// in /config/mycro-error.js
const bugsnag = require('bugsnag');
module.exports = function(mycro) {
return {
/**
* Configure notifiers
* @param {[type]} Err [description]
* @param {Function} done [description]
* @return {[type]} [description]
*/
configure(Err, done) {
bugsnag.register({ apiKey: '*********' });
Err.addNotifier(bugsnag.notify);
process.nextTick(done);
},
/**
* Define named errors.
* @type {Object}
*/
errors: {
myError: {
status: 500,
title: 'My Custom Error'
},
myOtherError: {
status: 403,
title: 'Missing Token'
}
}
};
}
```
## Testing
run tests
```bash
npm test
```
run coverage
```bash
npm run test
```
## Contributing
1. [Fork it](https://github.com/cludden/mycro-error/fork)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
## License
Copyright (c) 2016 Chris Ludden. Licensed under the [MIT License](LICENSE.md)