Skip to content
Snippets Groups Projects

Resolve "Cater for errors being nil and update checks for retryable errors"

1 file
+ 5
4
Compare changes
  • Side-by-side
  • Inline
  • 24b2338c
    #34 Check if err is not nil in errors.HTTPWithError. · 24b2338c
    Subhan Shah authored
+ 5
4
@@ -101,14 +101,15 @@ func HTTPCodeOnly(code int) 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
var errorMessage string
// This check is here just as a failsafe to seg faults, if err is nil then just return assign an empty string as message.
if err != nil {
errorMessage = err.Error()
}
wrappedErr := &CustomError{
code: code,
message: err.Error(),
message: errorMessage,
caller: GetCaller(2),
cause: err,
}
Loading