Added err detail

This commit is contained in:
zhenorzz 2023-09-04 15:03:45 +08:00
parent c0c9eb105d
commit 2d5fec2013
2 changed files with 3 additions and 2 deletions

View File

@ -26,7 +26,7 @@ func (git *GIT) Run(operator string, options ...string) error {
cmd.Stdout = &git.Output cmd.Stdout = &git.Output
cmd.Stderr = &git.Err cmd.Stderr = &git.Err
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return fmt.Errorf("error: %s, detail: %s", err, git.Err.String()) return fmt.Errorf("error: %s, detail: %s, command: %s, paste it to command-line to check if it is correct", err, git.Err.String(), cmd.String())
} }
return nil return nil
} }

View File

@ -6,6 +6,7 @@ package pkg
import ( import (
"bytes" "bytes"
"fmt"
"os/exec" "os/exec"
) )
@ -25,7 +26,7 @@ func (svn *SVN) Run(operator string, options ...string) error {
cmd.Stdout = &svn.Output cmd.Stdout = &svn.Output
cmd.Stderr = &svn.Err cmd.Stderr = &svn.Err
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {
return err return fmt.Errorf("error: %s, detail: %s, command: %s, paste it to command-line to check if it is correct", err, svn.Err.String(), cmd.String())
} }
return nil return nil
} }