Skip to content

Commit

Permalink
check conversion error
Browse files Browse the repository at this point in the history
  • Loading branch information
Sagleft committed Apr 4, 2024
1 parent a938790 commit d091f4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion v2/internal/utopia/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d091f4d

Please sign in to comment.