Skip to content

Commit

Permalink
fix: Move unhandled rejection listener to cli scripts (#339)
Browse files Browse the repository at this point in the history
  • Loading branch information
bkeepers committed Nov 21, 2017
1 parent 62e984c commit f8abe25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions bin/probot-simulate.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const probot = createProbot({
id: program.app,
cert: findPrivateKey()
})

probot.setup(program.args.slice(2))

probot.logger.debug('Simulating event', eventName)
Expand Down
7 changes: 4 additions & 3 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ const defaultApps = [
require('./plugins/default')
]

// Log all unhandled rejections
process.on('unhandledRejection', logger.error.bind(logger))

module.exports = (options = {}) => {
const webhook = createWebhook({path: options.webhookPath || '/', secret: options.secret || 'development'})
const app = createApp({
Expand Down Expand Up @@ -83,6 +80,10 @@ module.exports = (options = {}) => {
}

function setup (apps) {
// Log all unhandled rejections
process.on('unhandledRejection', logger.error.bind(logger))

// Load the given apps along with the default apps
apps.concat(defaultApps).forEach(app => load(app))
}

Expand Down

0 comments on commit f8abe25

Please sign in to comment.