hetznercloud / hcloud-go

A Go library for the Hetzner Cloud API
https://pkg.go.dev/github.com/hetznercloud/hcloud-go/v2/hcloud
MIT License
371 stars 45 forks source link

fix: `invalid_input` API errors may not return details #507

Closed jooola closed 1 month ago

jooola commented 1 month ago

The create uploaded certificate endpoint may return the following error:

{
  "error": {
    "code": "invalid_input",
    "message": "certificate must use larger key size"
  }
}

This change ensure that we do not get a json unmarshal error (unexpected end of json) while trying to parse a non-existing details data.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 71.46%. Comparing base (60c5428) to head (19d70d9).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #507 +/- ## ======================================= Coverage 71.46% 71.46% ======================================= Files 46 46 Lines 3935 3935 ======================================= Hits 2812 2812 Misses 710 710 Partials 413 413 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.