diff options
| author | hhvn <dev@hhvn.uk> | 2023-11-19 13:31:03 +0000 |
|---|---|---|
| committer | hhvn <dev@hhvn.uk> | 2023-11-19 13:31:28 +0000 |
| commit | a7e98ba0835c8c7278f298f34fecf6749432fc25 (patch) | |
| tree | b5c6f1e4ea2cfeee0da46c0b24cf24918652e81b /status/00-status.go | |
| parent | 3ad7ace9c1cc88b4ec4eed8c4eee801e1f659110 (diff) | |
Status error handling
Diffstat (limited to 'status/00-status.go')
| -rw-r--r-- | status/00-status.go | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/status/00-status.go b/status/00-status.go index d508eab..e88011d 100644 --- a/status/00-status.go +++ b/status/00-status.go @@ -1,12 +1,14 @@ package status // import "hhvn.uk/hbspbar/status" import ( + "fmt" "time" "sync" "image" - "hhvn.uk/hbspbar/config" "hhvn.uk/hbspbar/drw" + "hhvn.uk/hbspbar/config" + "hhvn.uk/hbspbar/common" ) var Status map[int]*status @@ -75,10 +77,26 @@ func newUpdate(name string) (*status) { return &s } +func checkError(name string, err error) { + if err == nil { return } + + common.Error("status \"%s\": %s\n", name, err) + + u := newUpdate(name) + u.drawText(0, Red, fmt.Sprintf("[err: %s]", name)) + updates <- u + + sleep(5) +} + func sleep(s int) { time.Sleep(time.Duration(s) * time.Second) } +func blendGYR(percent int) uint32 { + return drw.Blend3(Green, Yellow, Red, percent) +} + func (s *status) furthest(x int) { if x > s.W { s.W = x |