-
Notifications
You must be signed in to change notification settings - Fork 52
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
User messages for missing files #1863
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1863 +/- ##
==========================================
- Coverage 80.36% 80.36% -0.01%
==========================================
Files 580 580
Lines 65698 65706 +8
Branches 9259 9260 +1
==========================================
+ Hits 52800 52805 +5
- Misses 10844 10847 +3
Partials 2054 2054 |
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.
Might be useful to add a simple test case to cover this (although possibly overkill)?
Yes the former Co-authored-by: Richard Gildea <[email protected]>
Co-authored-by: Richard Gildea <[email protected]>
Not quite sure what this would be testing if it's just logger statements based on |
I think part of the confusion is that control flow here is rather non-obvious - this prints the message, but doesn't mark it as unhandled. In I don't think printing help is particularly helpful in this case, because there was (otherwise looking valid) input, and the giant block of text somewhat hides the actual error message. If the user asked for a file and it wasn't present, this seems a somewhat reasonable case to call What other downstream scenarios are there that a missing file here is a recoverable error? (Otherwise, this is a measurable improvement over a stack trace) |
Sorry this had slipped my mind. Yes I agree the solution isn't ideal. It would be more consistent for missing files to be caught in unhandled. My original reason for not doing this was that it's not particularly helpful for the user to see an argument is unhandled but not know it's due to missing files. A better solution might be changing unhandled arguments in general to be a dictionary which explain the reason for each unhandled argument (99% of which I'm guessing would just be unrecognised arguments). |
Even though I think we could do better here, this is absolutely an improvement to what we had before. |
The code changed '<image files>' to always be appended to the experiment list, even if there were no image files passed.
This adds a warning for dials.import if no input files are found when using a wildcard, and an error message if a specific requested file is missing.
Currently the behaviour when using wildcards is to show help if no files are found, or when using multiple wildcards to show nothing if some wildcards return nothing. This adds a warning to the user if a wildcard returns nothing.
The current behaviour for when a specific file is not found is to show the traceback from dxtbx. This pr hides the traceback and shows just the file not found error, followed by calling help.