Exception class indicating a problem while executing a management command. If this exception is raised during the execution of a management command, it will be caught and turned into a nicely-printed error message to the appropriate output stream (i.e., stderr); as a result
| 21 | |
| 22 | |
| 23 | class CommandError(Exception): |
| 24 | """ |
| 25 | Exception class indicating a problem while executing a management |
| 26 | command. |
| 27 | |
| 28 | If this exception is raised during the execution of a management |
| 29 | command, it will be caught and turned into a nicely-printed error |
| 30 | message to the appropriate output stream (i.e., stderr); as a |
| 31 | result, raising this exception (with a sensible description of the |
| 32 | error) is the preferred way to indicate that something has gone |
| 33 | wrong in the execution of a command. |
| 34 | """ |
| 35 | |
| 36 | def __init__(self, *args, returncode=1, **kwargs): |
| 37 | self.returncode = returncode |
| 38 | super().__init__(*args, **kwargs) |
| 39 | |
| 40 | |
| 41 | class SystemCheckError(CommandError): |
no outgoing calls