Improve error handling

This commit is contained in:
Ivan Danyliuk 2018-06-20 16:12:03 +02:00
parent 209d30d680
commit ede8dcb309
No known key found for this signature in database
GPG Key ID: 97ED33CE024E1DBF
1 changed files with 5 additions and 5 deletions

10
ws.go
View File

@ -2,7 +2,6 @@ package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"time"
@ -124,15 +123,14 @@ func (ws *WSServer) sendMsg(c *websocket.Conn, msg *WSResponse) {
}
}
func (ws *WSServer) refresh() {
log.Println("Getting peers from Status-cluster via SSH")
func (ws *WSServer) refresh() error {
log.Println("Getting peers from Status-cluster")
g, err := BuildGraph(ws.fetcher)
if err != nil {
log.Printf("[ERROR] Failed to fetch: %s", err)
return
return err
}
log.Printf("Loaded graph: %d nodes, %d links\n", len(g.Nodes()), len(g.Links()))
fmt.Println(g.Links()[0])
log.Printf("Initializing layout...")
repelling := layout.NewGravityForce(-10.0, layout.BarneHutMethod)
@ -144,4 +142,6 @@ func (ws *WSServer) refresh() {
ws.updateGraph(g, l)
ws.updatePositions()
return nil
}