From c46a72212e34c201ff7b71c705f2a985027924ca Mon Sep 17 00:00:00 2001 From: Subhan Shah <subhan@uafrica.com> Date: Thu, 3 Nov 2022 15:48:41 +0200 Subject: [PATCH] #34 Update errors.IsRetryableError to explicitly check and return false for any 400 errors. --- errors/error.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/errors/error.go b/errors/error.go index bb14c1d..65ac2fd 100644 --- a/errors/error.go +++ b/errors/error.go @@ -9,6 +9,7 @@ import ( ) // CustomError implements the following interfaces: +// // error // github.com/pkg/errors: Cause type CustomError struct { @@ -251,7 +252,7 @@ func IsRetryableError(err error) bool { if code == 0 { return false } - + // 429 should always retry if code == http.StatusTooManyRequests { return true @@ -262,5 +263,10 @@ func IsRetryableError(err error) bool { return true } + // Explicitly check for and return false for any 400s as well + if code >= 400 && code < 500 { + return false + } + return false } -- GitLab