[decorators] Add raise_on_error decorator
Click turns functions into "commands" which has the following consequences: - Any return statement means that it has succeeded whatever the value returned therefore the exit code will be 0 - To "fail" properly an exception must be raised which will return an exit code of 1 - Other exceptions will be treated as usage error and have an exit code of 2 The raise_on_error decorator will take the returned value of the wrapped function and raise a generic error with the exit code set to what the function has returned.
beat/cmdline/decorators.py
0 → 100644
Please register or sign in to comment