17 lines
294 B
Go

package error
import "fmt"
type WrappedError struct {
Err error
Context string
}
func (e *WrappedError) Error() string {
return fmt.Sprintf("%s: %s", e.Context, e.Err.Error())
}
func Wrap(err error, context string) *WrappedError {
return &WrappedError{Err: err, Context: context}
}