Skip to content
Snippets Groups Projects
Commit 34b6330a authored by Cornel Rautenbach's avatar Cornel Rautenbach
Browse files

Allow HTTP code without an explicit error

parent 89166cae
Branches
Tags v2.0.3
No related merge requests found
......@@ -74,10 +74,6 @@ func Wrap(err error, msg string) error {
}
func HTTP(code int, err error, format string, args ...interface{}) error {
if err == nil {
return nil
}
wrappedErr := &CustomError{
code: code,
message: fmt.Sprintf(format, args...),
......@@ -101,6 +97,10 @@ func HTTPWithMsg(code int, format string, args ...interface{}) error {
return wrappedErr
}
func HTTPCodeOnly(code int) error {
return HTTP(code, nil, "")
}
func HTTPWithError(code int, err error) error {
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