From 1bb2371e8d7c92ef533e29c7605b48ebc53adb7d Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 15 Feb 2014 15:38:41 -0500 Subject: [PATCH] More TODO reduction. --- label.go | 1 - lineedit.go | 1 - stack.go | 10 ++++------ todo.md | 1 - 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/label.go b/label.go index d924cd3..cadeff0 100644 --- a/label.go +++ b/label.go @@ -24,7 +24,6 @@ func NewLabel(text string) *Label { // TODO SetText()/Text()? -// TODO adorn error messages func (l *Label) make(window *sysData) error { l.lock.Lock() defer l.lock.Unlock() diff --git a/lineedit.go b/lineedit.go index 9c839c5..ac20030 100644 --- a/lineedit.go +++ b/lineedit.go @@ -37,7 +37,6 @@ func (l *LineEdit) Text() string { return l.initText } -// TODO adorn errors with what failed func (l *LineEdit) make(window *sysData) error { l.lock.Lock() defer l.lock.Unlock() diff --git a/stack.go b/stack.go index c36b22d..bb43d24 100644 --- a/stack.go +++ b/stack.go @@ -32,19 +32,17 @@ func NewStack(o Orientation, controls ...Control) *Stack { } } -// TODO adorn errors with which stage failed func (s *Stack) make(window *sysData) error { - for _, c := range s.controls { + for i, c := range s.controls { err := c.make(window) if err != nil { - return err + return fmt.Errorf("error adding control %d: %v", i, err) } } s.created = true return nil } -// TODO adorn errors with which stage failed func (s *Stack) setRect(x int, y int, width int, height int) error { var dx, dy int @@ -61,10 +59,10 @@ func (s *Stack) setRect(x int, y int, width int, height int) error { default: panic(fmt.Sprintf("invalid orientation %d given to Stack.setRect()", s.orientation)) } - for _, c := range s.controls { + for i, c := range s.controls { err := c.setRect(x, y, width, height) if err != nil { - return err + return fmt.Errorf("error setting size of control %d: %v", i, err) } x += dx y += dy diff --git a/todo.md b/todo.md index fa51614..77de3e6 100644 --- a/todo.md +++ b/todo.md @@ -35,7 +35,6 @@ far off: - localization - strip unused constants from the Windows files - combine more Windows files; rename some? -- normalize error handling to adorn errors with function call information maybe: - rename Stack to Box?