1.0.4 • Published 7 years ago

micro-rollbar v1.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

micro-rollbar

Build Status Greenkeeper badge XO code style styled with prettier

Rollbar error handler for Zeit's Micro

Installation

npm install --save micro-rollbar

Usage

Using the global error handler:

const {createError} = require('micro')
const microRollbar = require('micro-rollbar')

const errorHandler = microRollbar({
  accessToken: 'ROLLBAR_ACCESS_TOKEN'
})

module.exports = errorHandler(async (req, res) => {
  throw createError(500, 'Reported to rollbar')
})

Using the global error handler with additional options:

const {send} = require('micro')
const microRollbar = require('micro-rollbar')
const {debug, info, warning, error, critical} = microRollbar

// See Rollbar documentation for available options.
// https://rollbar.com/docs/notifier/rollbar.js/#standalone
const errorHandler = microRollbar({
  accessToken: 'ROLLBAR_ACCESS_TOKEN',
  environment: process.env.NODE_ENV || 'development',
  host: 'app.domain.com',
  enabled: process.env.NODE_ENV !== 'test'
})

module.exports = errorHandler(async (req, res) => {
  await info('Reported to rollbar')
  send(res, 200, 'Ready!')
})

Contributors

Thanks goes to these wonderful people (emoji key):

Brent Mealhouse💻 📖 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

Contributing

  1. Fork this repository to your own GitHub account and then clone it to your local device
  2. Install the dependencies: yarn
  3. Link the package to the global module directory: yarn link
  4. Run yarn test -- --watch and start making your changes
  5. You can use yarn link micro-rollbar to test your changes in an actual project

LICENSE

MIT

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago