Skip to content

Commit d091f4d

Browse files
committed
check conversion error
1 parent a938790 commit d091f4d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

request.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,10 @@ func (c *UtopiaClient) queryResultToInt(methodName string, params map[string]int
216216
return 0, err
217217
}
218218
result, err := strconv.ParseInt(resultstr, 10, 64)
219-
return result, err
219+
if err != nil {
220+
return 0, fmt.Errorf("parse query result: %w", err)
221+
}
222+
return result, nil
220223
}
221224

222225
func convertResult(response map[string]interface{}, toInterface interface{}) error {

v2/internal/utopia/request.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ func (c *UtopiaClient) queryResultToInt(
204204
return 0, err
205205
}
206206
result, err := strconv.ParseInt(resultstr, 10, 64)
207-
return result, err
207+
if err != nil {
208+
return 0, fmt.Errorf("parse query result: %w", err)
209+
}
210+
return result, nil
208211
}
209212

210213
func convertResult(response map[string]interface{}, toInterface interface{}) error {

0 commit comments

Comments
 (0)