RDFLib / sparqlwrapper

A wrapper for a remote SPARQL endpoint
https://sparqlwrapper.readthedocs.io/
Other
513 stars 121 forks source link

Fix CLI error reporting #202

Closed aucampia closed 2 years ago

aucampia commented 2 years ago

check_file is used as an argparse type, and as mentioned by the argparse docs:

https://docs.python.org/3/library/argparse.html#type

The argument to type can be any callable that accepts a single string. If the function raises ArgumentTypeError, TypeError, or ValueError, the exception is caught and a nicely formatted error message is displayed. No other exception types are handled.

This changes check_file to raise ArgumentTypeError so that the error gets reported correctly.

PR extracted from #197 and authored by @eggplants

aucampia commented 2 years ago

Done in https://github.com/RDFLib/sparqlwrapper/pull/204