mirror of
https://github.com/slackhq/nebula.git
synced 2025-12-06 02:30:57 -08:00
More like a library (#279)
This commit is contained in:
parent
6238f1550b
commit
68e3e84fdc
19 changed files with 608 additions and 153 deletions
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue