With other ClickExceptions I've seen (e.g. NoSuchOptionhttps://github.com/pallets/click/blob/master/click/exceptions.py#L165), if message is set to None then it gets reset as something more sensible e.g. "No such option 'foo'". This means that doing str(exc) works nicely. However, MissingParameter doesn't have this, which means any attempt to stringify (e.g. print or log) a MissingParameter actually causes a TypeError: __str__ returned non-string (type NoneType) and then things go badly wrong.
Is it expected that MissingParameter is an unprintable exception when caused e.g. by missing out a required argument? It seems odd that no one else has come across this before. I'm using click in a slightly unusual context in that I'm using the group/command/arg/option parsing stuff outside of a traditional command line script, which might be why no one has seen this if click does it's own special handling for MissingParameter errors.
TL;DR It would be nice if MissingParameter was printable when raised via Parameter.full_process_value (or ideally more generally).
It might be enough to have something along the lines of what NoSuchOption does?
The text was updated successfully, but these errors were encountered: