0.1.0 • Published 8 years ago

error.flynn v0.1.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

Build status Dependencies

Install

npm install --save error.flynn

Use

First, setup an Incoming Webhook in Slack https://<your team>.slack.com/services/

Then:

const express = require('express')
  , flynn = require('error.flynn')
  , app = express()
  ;

app.get('/', (req, res, next) => {
  next(new Error('Send me to Slack!'));
});
// Either set process.env.ERROR_FLYNN_URL or use the url as the first param for flynn)
app.use(flynn('https://hooks.slack.com/services/TOKEN'));
app.use((err, req, res, next) {
  res.sendStatus(500);
});

The last part (below the comment) could also be done more concisely:

app.use(flynn('https://hooks.slack.com/services/TOKEN'), (err, req, res, next) {
  res.sendStatus(500);
});

Tests

npm test

Example Output

Slack message