This repository has been archived on 2025-09-01. You can view files and clone it, but cannot push or open issues or pull requests.

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}
}