Skip to content

Commit

Permalink
better wrap error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
assafmo committed Oct 25, 2018
1 parent 51be565 commit 614c0b8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/google/gopacket/layers"
"github.com/google/gopacket/pcapgo"
flags "github.com/jessevdk/go-flags"
"github.com/pkg/errors"
)

const version = "0.8.8"
Expand Down Expand Up @@ -57,7 +56,7 @@ func joincap(args []string) error {
// if -h flag, help is printed by the library on exit
return nil
}
return errors.Wrap(err, "cmd flags error")
return fmt.Errorf("cmd flags error: %v", err)
}

// if -V flag, print version and exit
Expand All @@ -74,14 +73,14 @@ func joincap(args []string) error {
heap.Init(&minTimeHeap)
linkType, err := initHeapWithInputFiles(cmdFlags.Rest.InFiles[1:], &minTimeHeap, cmdFlags.Verbose)
if err != nil {
return err
return fmt.Errorf("cannot initiate merge: %v", err)
}

outputFile := os.Stdout
if cmdFlags.OutputFilePath != "-" {
outputFile, err = os.Create(cmdFlags.OutputFilePath)
if err != nil {
return errors.Wrap(err, fmt.Sprintf("cannot open %s for writing", cmdFlags.OutputFilePath))
return fmt.Errorf("cannot open %s for writing: %v", cmdFlags.OutputFilePath, err)
}
defer outputFile.Close()
}
Expand Down

0 comments on commit 614c0b8

Please sign in to comment.