From d091f4dc406e22749f93cb878165abce3a28a2b0 Mon Sep 17 00:00:00 2001 From: Sagleft Date: Thu, 4 Apr 2024 14:58:40 +0300 Subject: [PATCH] check conversion error --- request.go | 5 ++++- v2/internal/utopia/request.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/request.go b/request.go index b64c2e6..9a89ad1 100644 --- a/request.go +++ b/request.go @@ -216,7 +216,10 @@ func (c *UtopiaClient) queryResultToInt(methodName string, params map[string]int return 0, err } result, err := strconv.ParseInt(resultstr, 10, 64) - return result, err + if err != nil { + return 0, fmt.Errorf("parse query result: %w", err) + } + return result, nil } func convertResult(response map[string]interface{}, toInterface interface{}) error { diff --git a/v2/internal/utopia/request.go b/v2/internal/utopia/request.go index 923b19b..04c6789 100644 --- a/v2/internal/utopia/request.go +++ b/v2/internal/utopia/request.go @@ -204,7 +204,10 @@ func (c *UtopiaClient) queryResultToInt( return 0, err } result, err := strconv.ParseInt(resultstr, 10, 64) - return result, err + if err != nil { + return 0, fmt.Errorf("parse query result: %w", err) + } + return result, nil } func convertResult(response map[string]interface{}, toInterface interface{}) error {