1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-15 03:03:08 +08:00
Files
kubo/util/debugerror/debug.go
Ho-Sheng Hsiao bf22aeec0a Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00

31 lines
629 B
Go

// package debugerror provides ways to augment errors with additional
// information to allow for easier debugging.
package debugerror
import (
"errors"
"fmt"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/facebookgo/stackerr"
"github.com/ipfs/go-ipfs/util"
)
func Errorf(format string, a ...interface{}) error {
return Wrap(fmt.Errorf(format, a...))
}
// New returns an error that contains a stack trace (in debug mode)
func New(s string) error {
if util.Debug {
return stackerr.New(s)
}
return errors.New(s)
}
func Wrap(err error) error {
if util.Debug {
return stackerr.Wrap(err)
}
return err
}