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

fix: improve error messaging when mandatory flag is missing in file convert (#1429) #1487

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

harshadixit12
Copy link

@harshadixit12 harshadixit12 commented Jan 9, 2025

fix: improve error messaging when mandatory flag is missing in file convert (#1429)

When mandatory flags for file convert are missing, the error message is not helpful. In this commit, we have added additional validation to communicate more details in the message.
We have made use of the PersistentPreRunE function in cobra to validate the input passed in to flag.

How I have tested my changes:

  • Run file convert command with 'from' and 'to' specified (happy flow) - should not error out
  • Run file convert command without specifying the 'to' flag - should return helpful error message.

To do:

  • Define what flags we want to validate apart from 'to', and what the error messages should be, and make these changes
  • Add tests

…onvert (#1429)

When mandatory flags for file convert are missing, the error message is not helpful. In this commit, we have added additional validation to communicate more details in the message.
@CLAassistant
Copy link

CLAassistant commented Jan 9, 2025

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 7 lines in your changes missing coverage. Please review.

Project coverage is 29.40%. Comparing base (6d1f171) to head (e489ce3).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/file_convert.go 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1487      +/-   ##
==========================================
- Coverage   29.43%   29.40%   -0.03%     
==========================================
  Files          61       61              
  Lines        6537     6542       +5     
==========================================
  Hits         1924     1924              
- Misses       4474     4479       +5     
  Partials      139      139              

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

@mheap
Copy link
Member

mheap commented Jan 9, 2025

Can we expand this to from, and other string flags?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants