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(pkg/commands): provide ExitCodeError to use in place of os.Exit #2187

Merged
merged 2 commits into from
May 30, 2024

Conversation

thehowl
Copy link
Member

@thehowl thehowl commented May 24, 2024

This PR substitutes uses of os.Exit(1), and the hack of --set-exit-status=0 used in tests for gno lint, so that the idiomatic way to return an error without printing anything becomes commands.ExitCodeError. Additionally, this can support returning different exit codes (other than 1).

Contributors' checklist...
  • Added new tests, or not needed, or not feasible
  • Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory
  • Updated the official documentation or not needed
  • No breaking changes were made, or a BREAKING CHANGE: xxx message was included in the description
  • Added references to related issues and PRs
  • Provided any useful hints for running manual tests
  • Added new benchmarks to generated graphs, if any. More info here.

@thehowl thehowl self-assigned this May 24, 2024
@github-actions github-actions bot added 📦 🤖 gnovm Issues or PRs gnovm related 📦 🌐 tendermint v2 Issues or PRs tm2 related labels May 24, 2024
Copy link

codecov bot commented May 24, 2024

Codecov Report

Attention: Patch coverage is 16.66667% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 49.91%. Comparing base (e8b26ec) to head (f2223c7).

Files Patch % Lines
tm2/pkg/commands/command.go 0.00% 6 Missing ⚠️
tm2/pkg/commands/errors.go 0.00% 2 Missing ⚠️
gnovm/cmd/gno/run.go 0.00% 1 Missing ⚠️
gnovm/cmd/gno/test.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2187      +/-   ##
==========================================
- Coverage   49.94%   49.91%   -0.03%     
==========================================
  Files         577      578       +1     
  Lines       77859    77707     -152     
==========================================
- Hits        38890    38791      -99     
+ Misses      35840    35804      -36     
+ Partials     3129     3112      -17     
Flag Coverage Δ
gnovm 45.08% <50.00%> (-0.02%) ⬇️
tm2 54.38% <0.00%> (-0.11%) ⬇️

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

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

@thehowl thehowl changed the title feat(pkg/commands): provide ExitCodeError to use in place of os.Exit refactor(pkg/commands): provide ExitCodeError to use in place of os.Exit May 29, 2024
@thehowl thehowl changed the title refactor(pkg/commands): provide ExitCodeError to use in place of os.Exit feat(pkg/commands): provide ExitCodeError to use in place of os.Exit May 29, 2024
Copy link
Member

@gfanton gfanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea !

@gfanton gfanton merged commit 4940836 into master May 30, 2024
47 of 49 checks passed
@gfanton gfanton deleted the dev/morgan/err-exit-code branch May 30, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 🌐 tendermint v2 Issues or PRs tm2 related 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants