Skip to content

makerbot/error.flynn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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