Skip to content
Snippets Groups Projects
Commit 6dda333c authored by Francé Wilke's avatar Francé Wilke
Browse files

Add function errors.ToCustomError

parent 16c5af8e
Branches
Tags v1.187.0
No related merge requests found
......@@ -64,6 +64,19 @@ func Wrap(err error, msg string) *CustomError {
return wrappedErr
}
func ToCustomError(err error) *CustomError {
if err == nil {
return nil
}
wrappedErr := &CustomError{
caller: GetCaller(2),
cause: err,
}
return wrappedErr
}
func HTTP(code int, err error, format string, args ...interface{}) *CustomError {
wrappedErr := &CustomError{
code: code,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment