Add new exception GMTParameterError for invalid parameters#4003
Add new exception GMTParameterError for invalid parameters#4003
Conversation
cc89cb1 to
a4082e0
Compare
cf33edc to
e51bb31
Compare
| if required: | ||
| msg = ( | ||
| "Required parameter(s) are missing: " | ||
| f"{', '.join(repr(par) for par in required)}." | ||
| ) |
There was a problem hiding this comment.
For this case where the parameter(s) is required/compulsory, I'm wondering if we can move towards having the error being thrown natively by Python, instead of writing code like:
if kwargs.get("F") is None:
raise GMTParameterError(required={"filter_type"})Should we revisit #2896 which mentions PEP692, and also think about using PEP655's typing.Required qualifier (https://typing.python.org/en/latest/spec/callables.html#required-and-non-required-keys)? Maybe a step towards #262 is to disallow single character arguments for required parameters, so that we can have native Python errors?
There was a problem hiding this comment.
The main issue is that, with the new alias system #4000 implemented, **kwargs will no longer be needed. We will still keep **kwargs to support single-letter option flags, but other parameters won't be passed via kwargs anymore.
947d3f4 to
c2c81d7
Compare
No description provided.