From b9f0ad90ec3568cbb1a7a2452d51395377c03a99 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 9 Mar 2014 16:02:17 -0400 Subject: Steamrolled errors under panic() in Combobox/Listbox.Append()/InsertBefore() because screw Windows being different. --- sysdata_windows.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sysdata_windows.go') diff --git a/sysdata_windows.go b/sysdata_windows.go index bf72ba5..4b951f2 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -317,7 +317,7 @@ func (s *sysData) text() (str string) { return syscall.UTF16ToString(tc) } -func (s *sysData) append(what string) (err error) { +func (s *sysData) append(what string) { ret := make(chan uiret) defer close(ret) uitask <- &uimsg{ @@ -332,14 +332,13 @@ func (s *sysData) append(what string) (err error) { } r := <-ret if r.ret == uintptr(classTypes[s.ctype].addSpaceErr) { - return fmt.Errorf("out of space adding item to combobox/listbox (last error: %v)", r.err) + panic(fmt.Errorf("out of space adding item to combobox/listbox (last error: %v)", r.err)) } else if r.ret == uintptr(classTypes[s.ctype].selectedIndexErr) { - return fmt.Errorf("failed to add item to combobox/listbox (last error: %v)", r.err) + panic(fmt.Errorf("failed to add item to combobox/listbox (last error: %v)", r.err)) } - return nil } -func (s *sysData) insertBefore(what string, index int) (err error) { +func (s *sysData) insertBefore(what string, index int) { ret := make(chan uiret) defer close(ret) uitask <- &uimsg{ @@ -354,11 +353,10 @@ func (s *sysData) insertBefore(what string, index int) (err error) { } r := <-ret if r.ret == uintptr(classTypes[s.ctype].addSpaceErr) { - return fmt.Errorf("out of space adding item to combobox/listbox (last error: %v)", r.err) + panic(fmt.Errorf("out of space adding item to combobox/listbox (last error: %v)", r.err)) } else if r.ret == uintptr(classTypes[s.ctype].selectedIndexErr) { - return fmt.Errorf("failed to add item to combobox/listbox (last error: %v)", r.err) + panic(fmt.Errorf("failed to add item to combobox/listbox (last error: %v)", r.err)) } - return nil } func (s *sysData) selectedIndex() int { -- cgit v1.2.3