mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-07-26 09:58:40 +00:00
rearrange error return
This commit is contained in:
@@ -263,7 +263,7 @@ func (app *showbridgeApp) handleChannels() {
|
|||||||
app.routerMutex.Unlock()
|
app.routerMutex.Unlock()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
err, moduleErrors, routeErrors := app.router.UpdateConfig(config, false)
|
moduleErrors, routeErrors, err := app.router.UpdateConfig(config, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
app.logger.Error("failed to update router config", "error", err)
|
app.logger.Error("failed to update router config", "error", err)
|
||||||
app.routerMutex.Unlock()
|
app.routerMutex.Unlock()
|
||||||
|
|||||||
@@ -15,9 +15,9 @@ func (r *Router) GetRunningConfig() config.Config {
|
|||||||
return r.runningConfig
|
return r.runningConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Router) UpdateConfig(newConfig config.Config, triggerChangeChan bool) (error, []config.ModuleError, []config.RouteError) {
|
func (r *Router) UpdateConfig(newConfig config.Config, triggerChangeChan bool) ([]config.ModuleError, []config.RouteError, error) {
|
||||||
if !r.runningConfigMu.TryLock() {
|
if !r.runningConfigMu.TryLock() {
|
||||||
return errors.New("config update in progress"), nil, nil
|
return nil, nil, errors.New("config update in progress")
|
||||||
}
|
}
|
||||||
defer r.runningConfigMu.Unlock()
|
defer r.runningConfigMu.Unlock()
|
||||||
oldConfig := r.runningConfig
|
oldConfig := r.runningConfig
|
||||||
@@ -81,5 +81,5 @@ func (r *Router) UpdateConfig(newConfig config.Config, triggerChangeChan bool) (
|
|||||||
r.ConfigChange <- newConfig
|
r.ConfigChange <- newConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, moduleErrors, routeErrors
|
return moduleErrors, routeErrors, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ type Config struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Configurable interface {
|
type Configurable interface {
|
||||||
UpdateConfig(newConfig Config, triggerChangeChannel bool) (error, []ModuleError, []RouteError)
|
UpdateConfig(newConfig Config, triggerChangeChannel bool) ([]ModuleError, []RouteError, error)
|
||||||
GetRunningConfig() Config
|
GetRunningConfig() Config
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user