refactor: Remove old error handling library

Removes the old error handling library and switches to plain
fmt.Errorf calls.

There are several reasons for this:

* There are no useful types or handling here anyways, so output format
  is the only priority.
* Users don't care about getting stacktraces.
* My emotional wellbeing.

Fin de siècle.
This commit is contained in:
Vincent Ambo 2018-03-09 15:17:54 +01:00 committed by Vincent Ambo
parent b8722ce83b
commit 3aa2cb8d3e
7 changed files with 13 additions and 78 deletions

View file

@ -16,27 +16,16 @@ import (
"fmt"
"os"
"os/exec"
"github.com/polydawn/meep"
"strings"
)
type PassError struct {
meep.TraitAutodescribing
meep.TraitCausable
Output string
}
func GetFromPass(key string) (string, error) {
fmt.Fprintf(os.Stderr, "Attempting to look up %s in pass\n", key)
pass := exec.Command("pass", "show", key)
output, err := pass.CombinedOutput()
if err != nil {
return "", meep.New(
&PassError{Output: string(output)},
meep.Cause(err),
)
return "", fmt.Errorf("Pass lookup failed: %s (%v)", output, err)
}
trimmed := strings.TrimSpace(string(output))