Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit 1022490fc92892fb5c768d1768880436f85eadff Author: Wim <wim@42.be> Date: Thu Mar 16 23:05:11 2017 +0000 Fail when bridge is unable to join a channel (general) diff --git a/bridge/bridge.go b/bridge/bridge.go index 312792b..12fb71d 100644 --- a/bridge/bridge.go +++ b/bridge/bridge.go @@ -848 +8414 @@ 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  }   @@ -997 +10510 @@ 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   }   } diff --git a/gateway/gateway.go b/gateway/gateway.go index 254fb89..1f5c361 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -487 +4810 @@ 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  }