Problem:
However, if you want to send data to e.g., Sentry or perform some other action (logging, etc.) upon any Django management command error, there aren't built-in facilities to deal with this. Even writing your own command base class won't suffice, because that won't cover built-in or third-party commands.
Solution:
I propose a "got_command_exception" signal, which would operate similarly to "got_request_exception", except that it would pass in the management command class instance as the `sender`, and the provided args/kwargs. Being run inside of the exception handler would allow for logging.exception(...) and other exc_info needs.
Due to the fact that all commands run through the same call_command infrastructure, I think this is a good approach to solving the problem I described.
If a majority of folks think this is a good approach, I'll make a patch.
Thoughts?