Skip to content
Snippets Groups Projects
Commit 697404cb authored by Subhan Shah's avatar Subhan Shah
Browse files

#34 Check if err is nil in errors.HTTPWithError.

parent b6a26aed
No related branches found
No related tags found
Loading
...@@ -101,6 +101,11 @@ func HTTPCodeOnly(code int) error { ...@@ -101,6 +101,11 @@ func HTTPCodeOnly(code int) error {
} }
func HTTPWithError(code int, err error) error { func HTTPWithError(code int, err error) error {
// This check is here just as a failsafe, if err is nil then just return nil because there's nothing that happened.
if err == nil {
return nil
}
wrappedErr := &CustomError{ wrappedErr := &CustomError{
code: code, code: code,
message: err.Error(), message: err.Error(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment