Skip to content

Commit

Permalink
Show better error when slack subdomain isn't correctly set (rauchg#261)
Browse files Browse the repository at this point in the history
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
jamo authored and rauchg committed Jan 5, 2017
1 parent 1ced370 commit e9749ef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down

0 comments on commit e9749ef

Please sign in to comment.