cli icon indicating copy to clipboard operation
cli copied to clipboard

feat: improve error formatting

Open phm07 opened this issue 6 months ago • 1 comments

This PR adds additional error handling and formatting for invalid_input errors. See #1075 for more details.

Before:

$ hcloud server create --name "a a" --image debian-12 --type cpx11
hcloud: invalid input in field 'name' (invalid_input, ca050180d7ec9473)

After:

$ hcloud server create --name "a a" --image debian-12 --type cpx11 
hcloud: invalid input in field 'name' (invalid_input, ca050180d7ec9473)
- name: Name must be a valid hostname.

~~Note: As we are not inside the hcloud-go package we can't access the internal Correlation ID. Since invalid input errors are user errors we probably don't need them anyway.~~

phm07 avatar Jun 16 '25 08:06 phm07

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 70.46%. Comparing base (b937e5c) to head (fd54021). Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
internal/cmd/util/util.go 87.50% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1080      +/-   ##
==========================================
+ Coverage   70.43%   70.46%   +0.02%     
==========================================
  Files         243      243              
  Lines       10722    10738      +16     
==========================================
+ Hits         7552     7566      +14     
- Misses       2505     2507       +2     
  Partials      665      665              
Flag Coverage Δ
e2e 51.80% <0.00%> (-0.11%) :arrow_down:
unit 63.84% <87.50%> (+0.03%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

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

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Jun 16 '25 08:06 codecov[bot]