-
Notifications
You must be signed in to change notification settings - Fork 244
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
Updates the error output for an empty directory #5610
Updates the error output for an empty directory #5610
Conversation
✅ Deploy Preview for odo-docusaurus-preview canceled.
|
6b502d0
to
90c5bca
Compare
<!-- Thank you for opening a PR! Here are some things you need to know before submitting: 1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines 2. Label this PR accordingly with the '/kind' line 3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests 4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline Documentation: If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing --> **What type of PR is this:** <!-- Add one of the following kinds: /kind bug /kind feature /kind cleanup /kind tests /kind documentation Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well. --> **What does this PR do / why we need it:** Updates the error output for running `odo dev` or `odo deploy` in an empty directory. Telling the user to run the same command in a non-empty dir, OR use `odo init`. **Which issue(s) this PR fixes:** <!-- Specifying the issue will automatically close it when this PR is merged --> N/A **PR acceptance criteria:** - [X] Unit test - [X] Integration test - [X] Documentation **How to test changes / Special notes to the reviewer:** Signed-off-by: Charlie Drage <[email protected]>
90c5bca
to
46e8072
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -65,7 +65,7 @@ func (o *DeployOptions) Complete(cmdline cmdline.Cmdline, args []string) (err er | |||
return err | |||
} | |||
if isEmptyDir { | |||
return errors.New("this command cannot run in an empty directory, you need to run it in a directory containing source code") | |||
return errors.New("this command cannot run in an empty directory, run the command in a directory containing source code or initialize using 'odo init'") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we define a sentinel error for this one in the component pkg? Something like the following -
var EmptyDirError := errors.New("this command cannot run in an empty directory, run the command in a directory containing source code or initialize using 'odo init'")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @valaparthvi I want to try and keep the error logging consistent across odo
so I prefer not creating a sentinal error despite it being copy and pasted in two places...
Preferably because using those types of errors are unconventional and I want to make this PR more of a UI/UX change rather than adding to pkg/component instead of pkg/cli
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case,
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: valaparthvi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
<!-- Thank you for opening a PR! Here are some things you need to know before submitting: 1. Please read our developer guideline: https://github.com/redhat-developer/odo/wiki/Dev:-odo-Dev-Guidelines 2. Label this PR accordingly with the '/kind' line 3. Ensure you have written and ran the appropriate tests: https://github.com/redhat-developer/odo/wiki/Dev:-Writing-and-running-tests 4. Read how we approve and LGTM each PR: https://github.com/redhat-developer/odo/wiki/Pull-Requests:-Review-guideline Documentation: If you are pushing a change to documentation, please read: https://github.com/redhat-developer/odo/wiki/Documentation:-Contributing --> **What type of PR is this:** <!-- Add one of the following kinds: /kind bug /kind feature /kind cleanup /kind tests /kind documentation Feel free to use other [labels](https://github.com/redhat-developer/odo/labels) as needed. However one of the above labels must be present or the PR will not be reviewed. This instruction is for reviewers as well. --> **What does this PR do / why we need it:** Updates the error output for running `odo dev` or `odo deploy` in an empty directory. Telling the user to run the same command in a non-empty dir, OR use `odo init`. **Which issue(s) this PR fixes:** <!-- Specifying the issue will automatically close it when this PR is merged --> N/A **PR acceptance criteria:** - [X] Unit test - [X] Integration test - [X] Documentation **How to test changes / Special notes to the reviewer:** Signed-off-by: Charlie Drage <[email protected]>
What type of PR is this:
What does this PR do / why we need it:
Updates the error output for running
odo dev
orodo deploy
in anempty directory. Telling the user to run the same command in a non-empty
dir, OR use
odo init
.Which issue(s) this PR fixes:
N/A
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer:
Signed-off-by: Charlie Drage [email protected]