From 94c785f565a937314493cfe435cbe2a1ee6c157c Mon Sep 17 00:00:00 2001 From: distek Date: Tue, 20 Feb 2024 21:37:15 -0800 Subject: [PATCH] chore: more work on error consistency --- lib/pane.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pane.go b/lib/pane.go index f9fe945..89bb85f 100644 --- a/lib/pane.go +++ b/lib/pane.go @@ -30,7 +30,7 @@ func parsePaneLine(line string) (Pane, error) { split := strings.Split(line, ",") if len(split) != 7 { - return Pane{}, fmt.Errorf("lib: parsePaneLine: strings.Split: split: split length != 5: line=%s", line) + return Pane{}, fmt.Errorf("lib: parsePaneLine: strings.Split: split: split length != 7: line=%s", line) } // ID @@ -91,7 +91,7 @@ func GetPanes() ([]Pane, error) { } pane, err := parsePaneLine(l) if err != nil { - return nil, fmt.Errorf("lib: GetPanes: parsePaneLin: pane: err=%s, line=%s", err.Error(), l) + return nil, fmt.Errorf("lib: GetPanes: parsePaneLin: pane: err=%s, line=%s", err, l) } ret = append(ret, pane) @@ -143,7 +143,8 @@ func GetPaneInDir(pane Pane, dir string) (Pane, bool, error) { "-F": paneFmtLine, }, "") if err != nil { - return Pane{}, false, fmt.Errorf("lib: GetPaneInDir: Tmux: command failed: err=%s, stdout=%s, stderr=%s", err, o, e) + log.Println(e) + return Pane{}, false, fmt.Errorf("lib: GetPaneInDir: Tmux: command failed: %s", err) } o = strings.Split(o, "\n")[0] @@ -191,12 +192,13 @@ func SelectPane(pane Pane) error { } func SwapPanes(src, dest Pane) error { - o, e, err := Tmux(GlobalArgs, "swap-pane", map[string]string{ + _, e, err := Tmux(GlobalArgs, "swap-pane", map[string]string{ "-s": src.ID, "-t": dest.ID, }, "") if err != nil { - return fmt.Errorf("lib: swapPanes: Tmux: command failed: err=%s, stdout=%s, stderr=%s", err, o, e) + log.Println(e) + return fmt.Errorf("lib: swapPanes: Tmux: command failed: %s", err) } return nil