mirror of
https://github.com/ipfs/kubo.git
synced 2025-09-15 03:03:08 +08:00

- 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)
31 lines
629 B
Go
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
|
|
}
|