aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridge.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/bridge.go b/bridge.go
index 6b781c1..f78b8e3 100644
--- a/bridge.go
+++ b/bridge.go
@@ -221,10 +221,15 @@ func (bridge *Bridge) GetAllLights() ([]Light, error) {
for index := 1; index < 101; index++ {
light, err := bridge.GetLightByIndex(index)
if err != nil {
- break
+ break // Final light index reached, index does not exist.
}
lights = append(lights, light)
}
+ if len(lights) == 0 {
+ err := errors.New("Error: No lights found by GetAllLights.")
+ log.Println(err)
+ return lights, err
+ }
return lights, nil
}