keploy icon indicating copy to clipboard operation
keploy copied to clipboard

fix: ensured error logs not shown incase of an unknown command

Open VarunGitGood opened this issue 1 year ago • 3 comments

Related Issue

  • Incase of unknown command the logger should not be logging.

Closes: #1328

Describe the changes you've made

  • extracting the error for the errorString we can ensure no logging

Results after

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Code style update (formatting, local variables)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

Please let us know if any test cases are added

Please describe the tests(if any). Provide instructions how its affecting the coverage.

Describe if there is any unusual behaviour of your code(Write NA if there isn't)

A clear and concise description of it.

Checklist:

  • [x] My code follows the style guidelines of this project.
  • [x] I have performed a self-review of my own code.
  • [ ] I have commented my code, particularly in hard-to-understand areas.
  • [ ] I have made corresponding changes to the documentation.
  • [x] My changes generate no new warnings.
  • [ ] I have added tests that prove my fix is effective or that my feature works.
  • [ ] New and existing unit tests pass locally with my changes.

Screenshots (if any)

Original Updated
original screenshot updated screenshot

VarunGitGood avatar Feb 23 '24 13:02 VarunGitGood

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

github-actions[bot] avatar Feb 23 '24 13:02 github-actions[bot]

@PranshuSrivastava incase of unknown shorthand we see a similar log do let me know and please review at your convenience. Thanks!!

VarunGitGood avatar Feb 24 '24 11:02 VarunGitGood

@varun7singh yes this looks like a good approach to go about it.

PranshuSrivastava avatar Feb 24 '24 16:02 PranshuSrivastava

@PranshuSrivastava i've added for both flags and commands but note in some cmds like record.go and test.go we have

recordCmd.SilenceUsage = true
recordCmd.SilenceErrors = true

which does not allow the cobra error and the usage to print do let me know if we need them Thanks !!

VarunGitGood avatar Feb 25 '24 17:02 VarunGitGood

@PranshuSrivastava could you review this please Thanks!

VarunGitGood avatar Mar 04 '24 14:03 VarunGitGood

@varun7singh Please update your branch according to the refactored changes.

gouravkrosx avatar Mar 17 '24 14:03 gouravkrosx

@gouravkrosx the error seems to be resolved in later updates i'll close this pr

VarunGitGood avatar Mar 18 '24 13:03 VarunGitGood

closing the PR as issue solved in later updatesr

shivamsouravjha avatar Apr 29 '24 11:04 shivamsouravjha