Socket
Book a DemoInstallSign in
Socket

micro-rollbar

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

micro-rollbar

Rollbar error handler for Zeit's Micro

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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

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

LICENSE

MIT

Keywords

micro

FAQs

Package last updated on 24 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.