robotpy / robotpy-commands-v2

Python implementation of the WPILib Command Framework (2020+)
Other
2 stars 14 forks source link

Provide better error messages in IllegalCommandUse exceptions #47

Closed virtuald closed 3 months ago

virtuald commented 4 months ago

Things like

raise IllegalCommandUse(
                f"The deadline command cannot also be in the other commands!"
            )

Are fine, but not particularly user-friendly. I understand why Java/C++ don't do the friendly thing, but we can do better. Maybe something like?

raise IllegalCommandUse("message", deadline=deadline)

And have the constructor take msg, **kwargs, and append ", ".join(f"{k}={v!r}" for k, v in kwargs.items())?

Might do in #46, we'll see.