mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Handle NewRelic connectivity errors
This commit is contained in:
parent
2d09ae74eb
commit
5637adf601
@ -34,14 +34,26 @@ func (widget *Widget) Refresh() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
app, _ := Application()
|
app, appErr := Application()
|
||||||
deploys, _ := Deployments()
|
deploys, depErr := Deployments()
|
||||||
|
|
||||||
widget.View.SetTitle(fmt.Sprintf(" New Relic: [green]%s[white] ", app.Name))
|
appName := "error"
|
||||||
|
if appErr == nil {
|
||||||
|
appName = app.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
widget.View.SetTitle(fmt.Sprintf(" New Relic: [green]%s[white] ", appName))
|
||||||
widget.RefreshedAt = time.Now()
|
widget.RefreshedAt = time.Now()
|
||||||
|
|
||||||
widget.View.Clear()
|
widget.View.Clear()
|
||||||
fmt.Fprintf(widget.View, "%s", widget.contentFrom(deploys))
|
|
||||||
|
if depErr != nil {
|
||||||
|
widget.View.SetWrap(true)
|
||||||
|
fmt.Fprintf(widget.View, "%s", depErr)
|
||||||
|
} else {
|
||||||
|
widget.View.SetWrap(false)
|
||||||
|
fmt.Fprintf(widget.View, "%s", widget.contentFrom(deploys))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user