Commit af667df6 authored by suyanlong's avatar suyanlong

add traceError error

parent 81722a5e
package tool
import (
"fmt"
"runtime"
"github.com/juju/errors"
)
var Annotate = errors.Annotate
func TraceError(err error, skip int) error {
if err == nil {
return nil
}
_, file, line, ok := runtime.Caller(skip + 1)
if !ok {
return err
}
return fmt.Errorf("%s:%d: %s", file, line, err)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment