Skip to content

Commit

Permalink
core: use multierror when handling Robot Stop
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Dec 1, 2016
1 parent 5e56638 commit 0764500
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions robot.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,20 @@ func (r *Robot) Start(args ...interface{}) (err error) {
}

// Stop stops a Robot's connections and Devices
func (r *Robot) Stop() (err error) {
func (r *Robot) Stop() error {
var result error
log.Println("Stopping Robot", r.Name, "...")
err = r.Devices().Halt()
err := r.Devices().Halt()
if err != nil {
result = multierror.Append(result, err)
}
err = r.Connections().Finalize()
if err != nil {
result = multierror.Append(result, err)
}

r.done <- true
return err
return result
}

// Devices returns all devices associated with this Robot.
Expand Down

0 comments on commit 0764500

Please sign in to comment.