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

Raise an error (or a warning) if a provided file is inaccessible #742

Closed
jdmichaud opened this issue Sep 21, 2021 · 3 comments · Fixed by #743
Closed

Raise an error (or a warning) if a provided file is inaccessible #742

jdmichaud opened this issue Sep 21, 2021 · 3 comments · Fixed by #743

Comments

@jdmichaud
Copy link

If the file provided to the --file option is not accessible (no read access or wrong path) lab just fails silently as if no file were provided. It makes troubleshooting more difficult than it needs to be, for example if there is subtle typo in the path.

Raising an error or at least a warning that the provided file is invalid would enhance the user experience.

@zampierilucas
Copy link
Collaborator

zampierilucas commented Sep 21, 2021

@jdmichaud Thank you for your issue :D, I'm dealing with something similar in #708, but I do get a warning when the path is wrong, which arguments are you passing when experience this issue?

@jdmichaud
Copy link
Author

jdmichaud commented Sep 22, 2021

@zampierilucas If I am doing this:

lab mr create --file /non/existent/file

I get this error:

2021/09/22 08:10:34 ERROR: mr_create.go:234:aborting MR due to empty MR msg

If I were to call lab me create with no additional option, I would get the same error message.

In my case, I had to look around the issue tracker for a few minutes until I realized I had a subtle typo in the path. Even worse, if for example you use a path starting with ~/ in the config file, you will get the same error even if the path is correct because lab does not expand the ~. All in all, if lab were to explicitly warn of inaccessible file, it would improve the UX experience.

@prarit
Copy link
Collaborator

prarit commented Sep 22, 2021

This should be easy to warn on. I'll take a look.

prarit added a commit to prarit/lab that referenced this issue Sep 22, 2021
Currently, when the file specified with the -F or -f options does not
exist, lab outputs a very generic error that is not helpful to users

[prarit@prarit kernel-test]$ ~/git-kernel/github/lab/lab mr create
2021/09/22 07:14:40 ERROR: mr_create.go:289: empty MR message

Check to see if the file exists and report a better error if the file is
not present.  For example,

[prarit@prarit kernel-test]$ ~/git-kernel/github/lab/lab mr create -F /tmp/non-existent.file
2021/09/22 07:15:02 ERROR: mr_create.go:244: file /tmp/non-existent.file cannot be found

Fixes zaquestion#742

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
prarit added a commit that referenced this issue Sep 22, 2021
Currently, when the file specified with the -F or -f options does not
exist, lab outputs a very generic error that is not helpful to users

[prarit@prarit kernel-test]$ ~/git-kernel/github/lab/lab mr create
2021/09/22 07:14:40 ERROR: mr_create.go:289: empty MR message

Check to see if the file exists and report a better error if the file is
not present.  For example,

[prarit@prarit kernel-test]$ ~/git-kernel/github/lab/lab mr create -F /tmp/non-existent.file
2021/09/22 07:15:02 ERROR: mr_create.go:244: file /tmp/non-existent.file cannot be found

Fixes #742

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
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 a pull request may close this issue.

3 participants