core: use multierror when handling Robot Stop
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
5e56638018
commit
0764500955
14
robot.go
14
robot.go
|
@ -185,12 +185,20 @@ func (r *Robot) Start(args ...interface{}) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop stops a Robot's connections and Devices
|
// 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, "...")
|
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()
|
err = r.Connections().Finalize()
|
||||||
|
if err != nil {
|
||||||
|
result = multierror.Append(result, err)
|
||||||
|
}
|
||||||
|
|
||||||
r.done <- true
|
r.done <- true
|
||||||
return err
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// Devices returns all devices associated with this Robot.
|
// Devices returns all devices associated with this Robot.
|
||||||
|
|
Loading…
Reference in New Issue