# Path: cloudify_agent/api/exceptions.py
# class DaemonException(BaseException):
# class DaemonStartupTimeout(DaemonException):
# class DaemonShutdownTimeout(DaemonException):
# class DaemonStillRunningException(DaemonException):
# class DaemonError(BaseException):
# class DaemonConfigurationError(DaemonError):
# class DaemonPropertiesError(DaemonError):
# class DaemonMissingMandatoryPropertyError(DaemonPropertiesError):
# class DaemonNotConfiguredError(DaemonError):
# class DaemonNotFoundError(DaemonError):
# class DaemonAlreadyExistsError(DaemonError):
# class DaemonNotImplementedError(DaemonError):
#     def __init__(self, timeout, name):
#     def __str__(self):
#     def __init__(self, timeout, name):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, param):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, process_management):
#     def __str__(self):


import click
import sys
from functools import wraps
from cloudify._compat import reraise
from cloudify_agent.api import exceptions
    exceptions.DaemonStartupTimeout: 103,
    exceptions.DaemonStillRunningException: 104,

    # errors start from 200
    exceptions.DaemonError: 201,
    exceptions.DaemonAlreadyExistsError: 202,
    exceptions.DaemonNotFoundError: 203,
    exceptions.DaemonConfigurationError: 204,
    exceptions.DaemonMissingMandatoryPropertyError: 205,
    exceptions.DaemonNotImplementedError: 206,
    exceptions.DaemonPropertiesError: 207,
    exceptions.DaemonNotConfiguredError: 208,
    exceptions.PluginInstallationError: 209
}


def handle_failures(func):

    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except BaseException as e:
            tpe, value, tb = sys.exc_info()

            if isinstance(e, exceptions.DaemonException):

                # convert api exceptions to click exceptions.
                value = click.ClickException(str(e))


# Path: cloudify_agent/api/exceptions.py
# class DaemonException(BaseException):
# class DaemonStartupTimeout(DaemonException):
# class DaemonShutdownTimeout(DaemonException):
# class DaemonStillRunningException(DaemonException):
# class DaemonError(BaseException):
# class DaemonConfigurationError(DaemonError):
# class DaemonPropertiesError(DaemonError):
# class DaemonMissingMandatoryPropertyError(DaemonPropertiesError):
# class DaemonNotConfiguredError(DaemonError):
# class DaemonNotFoundError(DaemonError):
# class DaemonAlreadyExistsError(DaemonError):
# class DaemonNotImplementedError(DaemonError):
#     def __init__(self, timeout, name):
#     def __str__(self):
#     def __init__(self, timeout, name):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, param):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, name):
#     def __str__(self):
#     def __init__(self, process_management):
#     def __str__(self):


# Path: cloudify_agent/shell/decorators.py
import click
import sys
from functools import wraps
from cloudify._compat import reraise
from cloudify_agent.api import exceptions

    exceptions.DaemonStartupTimeout: 103,
    exceptions.DaemonStillRunningException: 104,

    # errors start from 200
    exceptions.DaemonError: 201,
    exceptions.DaemonAlreadyExistsError: 202,
    exceptions.DaemonNotFoundError: 203,
    exceptions.DaemonConfigurationError: 204,
    exceptions.DaemonMissingMandatoryPropertyError: 205,
    exceptions.DaemonNotImplementedError: 206,
    exceptions.DaemonPropertiesError: 207,
    exceptions.DaemonNotConfiguredError: 208,
    exceptions.PluginInstallationError: 209
}


def handle_failures(func):

    @wraps(func)
    def wrapper(*args, **kwargs):
        try:
            func(*args, **kwargs)
        except BaseException as e:
            tpe, value, tb = sys.exc_info()

            if isinstance(e, exceptions.DaemonException):

                # convert api exceptions to click exceptions.
                value = click.ClickException(str(e))


            if isinstance(e, exceptions.DaemonError):