Skip to content

Commit e9749ef

Browse files
jamorauchg
authored andcommitted
Show better error when slack subdomain isn't correctly set (rauchg#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.
1 parent 1ced370 commit e9749ef

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/slack.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ export default class SlackData extends EventEmitter {
2121
.get(`https://${this.host}.slack.com/api/channels.list`)
2222
.query({ token: this.token })
2323
.end((err, res) => {
24+
if (err) {
25+
throw err;
26+
}
2427
(res.body.channels || []).forEach(channel => {
2528
this.channelsByName[channel.name] = channel
2629
})

0 commit comments

Comments
 (0)