1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Refactor a number of widgets to display client errors

Rather than swallowing or crashing, display appropriate errors
This commit is contained in:
Sean Smith
2019-09-01 13:19:07 -04:00
parent ff77a3deb0
commit 8835f532cc
12 changed files with 83 additions and 60 deletions

View File

@@ -9,13 +9,17 @@ func (widget *Widget) display() {
}
func (widget *Widget) content() (string, string, bool) {
title := widget.CommonSettings().Title
if widget.err != nil {
return title, widget.err.Error(), true
}
project := widget.currentGerritProject()
if project == nil {
return widget.CommonSettings().Title, "Gerrit project data is unavailable", true
return title, "Gerrit project data is unavailable", true
}
title := fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
title = fmt.Sprintf("%s- %s", widget.CommonSettings().Title, widget.title(project))
_, _, width, _ := widget.View.GetRect()
str := widget.settings.common.SigilStr(len(widget.GerritProjects), widget.Idx, width) + "\n"