Log and propagate error instead of using Fatal

This commit is contained in:
Jiri Luzny
2023-12-25 01:27:38 +01:00
parent ccb0f19d41
commit 628544c7a0
7 changed files with 40 additions and 8 deletions

View File

@@ -141,7 +141,9 @@ func SubscribeToEventType(eventType string, conn *WebsocketWriter, ctx context.C
}
err := conn.WriteMessage(e, ctx)
if err != nil {
slog.Error("Error writing to websocket: %s\n", err)
wrappedErr := fmt.Errorf("error writing to websocket: %w", err)
slog.Error(wrappedErr.Error())
panic(wrappedErr)
}
// m, _ := ReadMessage(conn, ctx)
// log.Default().Println(string(m))