Permalink
Browse files

Show better error when slack subdomain isn't correctly set (#261)

e.g when `SLACK_SUBDOMAIN="<zeit-community>"` following error would show up:
```
/home/nowuser/src/dist/slack.js:53
        (res.body.channels || []).forEach(function (channel) {
            ^
TypeError: Cannot read property 'body' of undefined
```

When really err is populated and contains real error.
  • Loading branch information...
1 parent 1ced370 commit e9749ef9e79b61d1b7bbfc7143abde566a253675 @jamo jamo committed with Jan 5, 2017
Showing with 3 additions and 0 deletions.
  1. +3 −0 lib/slack.js
View
@@ -21,6 +21,9 @@ export default class SlackData extends EventEmitter {
.get(`https://${this.host}.slack.com/api/channels.list`)
.query({ token: this.token })
.end((err, res) => {
+ if (err) {
+ throw err;
+ }
(res.body.channels || []).forEach(channel => {
this.channelsByName[channel.name] = channel
})

0 comments on commit e9749ef

Please sign in to comment.