More like a library (#279)

This commit is contained in:
Nathan Brown 2020-09-18 09:20:09 -05:00 committed by GitHub
parent 6238f1550b
commit 68e3e84fdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 608 additions and 153 deletions

View file

@ -1,6 +1,8 @@
package nebula
import (
"errors"
"github.com/sirupsen/logrus"
)
@ -15,10 +17,16 @@ func NewContextualError(msg string, fields map[string]interface{}, realError err
}
func (ce ContextualError) Error() string {
if ce.RealError == nil {
return ce.Context
}
return ce.RealError.Error()
}
func (ce ContextualError) Unwrap() error {
if ce.RealError == nil {
return errors.New(ce.Context)
}
return ce.RealError
}