Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added exit codes for CLI daemon command errors #2400

Merged
merged 2 commits into from
Nov 3, 2023

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Nov 3, 2023

Please check if the PR fulfills these requirements

See how to contribute

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • configuration.schema.json updated if new parameters are added.

What kind of change does this PR introduce?

Makes the daemon command return a consistent exit code for specific errors.

What is the current behavior?

The exit code was a bit random:

  • If "CLI failed to open a TCP port to listen for incoming connections" the exit code could be 1 (Generic error), 5 (Network error), or 0 (Success!)
  • If "TCP port argument is not valid" the exit code could be 6 (Core config error) or 7 (Bad Argument error).

What is the new behavior?

The following error codes have been added:

  • code 8: CLI failed to open a TCP port to listen for incoming connections
  • code 9: TCP port argument is not valid

Does this PR introduce a breaking change, and is titled accordingly?

Other information

Related to #2352

@cmaglie cmaglie added type: imperfection Perceived defect in any part of project topic: CLI Related to the command line interface labels Nov 3, 2023
@cmaglie cmaglie self-assigned this Nov 3, 2023
Copy link

codecov bot commented Nov 3, 2023

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (cc3396f) 64.58% compared to head (5874dec) 64.61%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2400      +/-   ##
==========================================
+ Coverage   64.58%   64.61%   +0.03%     
==========================================
  Files         207      207              
  Lines       19634    19634              
==========================================
+ Hits        12681    12687       +6     
+ Misses       5863     5859       -4     
+ Partials     1090     1088       -2     
Flag Coverage Δ
unit 64.61% <0.00%> (+0.03%) ⬆️

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

Files Coverage Δ
internal/cli/daemon/daemon.go 48.51% <0.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@umbynos umbynos linked an issue Nov 3, 2023 that may be closed by this pull request
3 tasks
@cmaglie cmaglie merged commit aeac305 into arduino:master Nov 3, 2023
95 checks passed
@cmaglie cmaglie deleted the deamon-exit-codes branch November 3, 2023 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: CLI Related to the command line interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feature: add some specific exit error-codes for daemon startup
2 participants