fix refactor error

This commit is contained in:
Sam Lewis
2022-10-31 01:20:52 -04:00
parent 8a59770936
commit ce6649dd29
2 changed files with 3 additions and 2 deletions

3
app.go
View File

@@ -2,6 +2,7 @@ package gomeassistant
import (
"context"
"fmt"
"log"
"os"
"time"
@@ -139,7 +140,7 @@ func getSunriseSunset(a *app, sunrise bool, offset []DurationString) carbon.Carb
// get next sunrise/sunset time from HA
state, err := a.state.Get("sun.sun")
if err != nil {
panic("Couldn't get sun.sun state from HA to calculate", printString)
panic(fmt.Sprintf("Couldn't get sun.sun state from HA to calculate %s", printString))
}
nextSetOrRise := carbon.Parse(state.Attributes[attrKey].(string))

View File

@@ -132,7 +132,7 @@ func SubscribeToEventType(eventType string, conn *websocket.Conn, ctx context.Co
}
err := WriteMessage(e, conn, ctx)
if err != nil {
panic("Error writing to websocket: ", err)
panic(fmt.Sprintf("Error writing to websocket: %s", err))
}
// m, _ := ReadMessage(conn, ctx)
// log.Default().Println(string(m))