Fail when bridge is unable to join a channel (general)

This commit is contained in:
Wim 2017-03-16 23:05:11 +01:00
parent 9407aa4600
commit fd8cfb11fb
2 changed files with 16 additions and 4 deletions

View File

@ -84,8 +84,14 @@ func New(cfg *config.Config, bridge *config.Bridge, c chan config.Message) *Brid
func (b *Bridge) JoinChannels() error {
exists := make(map[string]bool)
b.joinChannels(b.ChannelsIn, exists)
b.joinChannels(b.ChannelsOut, exists)
err := b.joinChannels(b.ChannelsIn, exists)
if err != nil {
return err
}
err = b.joinChannels(b.ChannelsOut, exists)
if err != nil {
return err
}
return nil
}
@ -99,7 +105,10 @@ func (b *Bridge) joinChannels(cMap map[string]config.ChannelOptions, exists map[
log.Debugf("using key %s for channel %s", info.Key, channel)
mychannel = mychannel + " " + info.Key
}
b.JoinChannel(mychannel)
err := b.JoinChannel(mychannel)
if err != nil {
return err
}
exists[channel] = true
}
}

View File

@ -48,7 +48,10 @@ func (gw *Gateway) AddBridge(cfg *config.Bridge) error {
if err != nil {
return fmt.Errorf("Bridge %s failed to start: %v", br.Account, err)
}
br.JoinChannels()
err = br.JoinChannels()
if err != nil {
return fmt.Errorf("Bridge %s failed to join channel: %v", br.Account, err)
}
return nil
}