Added enhanced logging for specific errors related to dehash tied into the apiu calls. Added logs subcommand.

This commit is contained in:
Evan Hosinski
2025-05-15 16:23:59 -04:00
parent 749f2b5eb8
commit c29f18a056
6 changed files with 436 additions and 113 deletions
+13
View File
@@ -163,6 +163,19 @@ func (dcv2 *DehashedClientV2) Search(searchRequest DehashedSearchRequest) (int,
)
return -1, errors.New("response was nil")
}
// Check for HTTP status code errors
if res.StatusCode != 200 {
dhErr := GetDehashedError(res.StatusCode)
fmt.Printf("[%d] API Error message: %s\n", res.StatusCode, dhErr.Error())
zap.L().Error("v2_search",
zap.String("message", "received error status code"),
zap.Int("status_code", res.StatusCode),
zap.String("error", dhErr.Error()),
)
return -1, &dhErr
}
b, err := io.ReadAll(res.Body)
if err != nil {
zap.L().Error("v2_search",