Fix error handling during type autodetection in create mode#91
Open
Fix error handling during type autodetection in create mode#91
Conversation
When specifying an unknown filename without type in create mode
the exception is not handled correctly:
$ cfv -C -f asdf
Traceback (most recent call last):
File "/persist/cfv/test/cfv", line 9, in <module>
cfv.common.main()
~~~~~~~~~~~~~~~^^
File "/persist/cfv/lib/cfv/common.py", line 2314, in main
raise CFVValueError('specify a filetype with -t, or use standard extension')
cfv.exceptions.CFVValueError: specify a filetype with -t, or use standard extension
This fix handles and displays the error correctly:
$ cfv -C -f asdf
cfv: specify a filetype with -t, or use standard extension
|
Good catch, had it on my TODO as well. One suggestion - instead of replacing the raise with view.perror(...) + sys.exit(1), consider wrapping the post parse execution phase in its own try/except CFVValueError and using the same cfv: ... handler there. That keeps the raise in place and handles these runtime CFVValueErrors in one consistent place. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When specifying an unknown filename without type in create mode the exception is not handled correctly:
This fix handles and displays the error correctly: