Skip to content

Commit

Permalink
breaking: log warning instead of throwing error for unknown events
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Before, this code would throw an error

```js
webhooks.on(woodstock, handler)
```

Now it logs a warning: `"woodstock" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`
  • Loading branch information
gr2m committed Mar 20, 2018
1 parent a859805 commit bf41e16
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion event-handler/on.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function receiverOn (state, webhookNameOrNames, handler) {
}

if (webhookNames.indexOf(webhookNameOrNames) === -1) {
throw new Error(`${webhookNameOrNames} is not a valid webhook name`)
console.warn(`"${webhookNameOrNames}" is not a known webhook name (https://developer.github.com/v3/activity/events/types/)`)
}

if (!state.hooks[webhookNameOrNames]) {
Expand Down

0 comments on commit bf41e16

Please sign in to comment.