Skip to content

Commit

Permalink
feat: add additional error checks
Browse files Browse the repository at this point in the history
Signed-off-by: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com>
  • Loading branch information
darkmatterpool committed Oct 5, 2022
1 parent 79c5cef commit 89baaf9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/bridge/connectors/wise/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ func (w *client) getProfiles() ([]profile, error) {
return profiles, err
}

b, _ := io.ReadAll(res.Body)
b, err := io.ReadAll(res.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}

err = json.Unmarshal(b, &profiles)
if err != nil {
Expand Down Expand Up @@ -94,7 +97,11 @@ func (w *client) getTransfers(profile *profile) ([]transfer, error) {
return transfers, err
}

b, _ := io.ReadAll(res.Body)
b, err := io.ReadAll(res.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}

err = json.Unmarshal(b, &ts)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal transfers: %w", err)
Expand Down

0 comments on commit 89baaf9

Please sign in to comment.