Skip to content
  • Samuel GAIST's avatar
    [decorators] Add raise_on_error decorator · 151292b5
    Samuel GAIST authored
    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.
    151292b5