Repository navigation
Report an unknown geotag source as a bad parameter - #863
Merged
Merged
Conversation
A misspelled source type, as in --geotag_source foo or gpx,foo, failed
with a ValueError traceback ("'foo' is not a valid SourceType"), and a
JSON source with a key the schema does not know, such as
{"source": "gpx", "path": "track.gpx"}
failed with a jsonschema ValidationError traceback. Both exited 1, as for
a crash.
They now raise MapillaryBadParameterError (exit code 2), naming the
supported source types and their aliases, or what the schema rejected
("'path' was unexpected"). This covers --geotag_source and
--video_geotag_source in process and video_process, which parse them the
same way.
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.
Problem
A misspelled geotag source, or a JSON source with a key the schema does not know, crashed with a traceback (exit 1):
Fix
factory.parse_source_option()raisesMapillaryBadParameterError(exit 2). An unknown type names the supported source types and their aliases. A JSON source that fails the schema says what was rejected. This covers--geotag_sourceand--video_geotag_source, thea,bform, andprocessandvideo_process, which parse them the same way. Valid sources parse as before.Verification
foo,gpx,foo,123, an unknown JSON key and a badfiletypesvalue all exit 2 with a one-line message, onprocessandvideo_process.mypy --python-version 3.9,ruff check,ruff format --checkandusort diffare clean.