-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #541 from OdyseeTeam/fix-random-endpoint
Do not retry input errors
- Loading branch information
Showing
5 changed files
with
76 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package query | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/ybbus/jsonrpc/v2" | ||
) | ||
|
||
var userInputSDKErrors = []string{ | ||
"expected string or bytes-like object", | ||
} | ||
|
||
// isUserInputError checks if error is of the kind where retrying a request with the same input will result in the same error. | ||
func isUserInputError(resp *jsonrpc.RPCResponse) bool { | ||
for _, m := range userInputSDKErrors { | ||
if strings.Contains(resp.Error.Message, m) { | ||
return true | ||
} | ||
|
||
} | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters