From 6a71720b71149fd252ef5dba179a63fc93b23aae Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Wed, 1 May 2019 09:40:59 +0200 Subject: [PATCH] Init function can return an error. --- ui/control.go | 2 +- ui/ui.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/control.go b/ui/control.go index c74d3ec..7ad5068 100644 --- a/ui/control.go +++ b/ui/control.go @@ -24,5 +24,5 @@ type Control interface { type RootControl interface { Control - Init(Context) + Init(Context) error } diff --git a/ui/ui.go b/ui/ui.go index 6a847d8..c1e36bd 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -16,7 +16,10 @@ func RunWait(r Renderer, s *Style, view Control, wait bool) error { ctx := &context{r: r, style: s, view: view, ims: NewImages(r)} root, ok := view.(RootControl) if ok { - root.Init(ctx) + err := root.Init(ctx) + if err != nil { + return err + } } anim := time.NewTicker(30 * time.Millisecond) go func() {