1
0
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:
Chris Cummer 2018-04-10 08:56:44 -07:00 committed by Chris Cummer
parent 2d09ae74eb
commit 5637adf601

View File

@ -34,14 +34,26 @@ func (widget *Widget) Refresh() {
return
}
app, _ := Application()
deploys, _ := Deployments()
app, appErr := Application()
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.View.Clear()
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 -------------------- */