# Path: devicehive/device.py
# class DeviceError(ApiRequestError):
#     """Device error."""
# 
# Path: devicehive/subscription.py
# class SubscriptionError(ApiRequestError):
#     """Subscription error."""
# 
# Path: devicehive/api_response.py
# class ApiResponseError(TransportError):
#     """Api response error."""
# 
#     def __init__(self, message, transport_name, code, error):
#         message = '%s Transport: %s. Code: %s. Error: %s' % (message,
#                                                              transport_name,
#                                                              code, error)
#         super(ApiResponseError, self).__init__(message)
#         self._transport_name = transport_name
#         self._code = code
#         self._error = error
# 
#     @property
#     def transport_name(self):
#         return self._transport_name
# 
#     @property
#     def code(self):
#         return self._code
# 
#     @property
#     def error(self):
#         return self._error


from devicehive import DeviceError, SubscriptionError
from devicehive import ApiResponseError
            return
        handler.data['subscription'].remove()
        handler.data['device'].remove()
        handler.disconnect()

    test.run(handle_connect, handle_command_insert)

    def handle_connect(handler):
        device, command_names, command_ids = init_data(handler)
        command_name = command_names[:1]
        set_handler_data(handler, device, command_names, command_ids)
        send_data(handler, device, command_name)
        handler.data['subscription'] = device.subscribe_insert_commands(
            names=command_name)

    def handle_command_insert(handler, command):
        assert command.id == handler.data['command_ids'][0]
        handler.data['subscription'].remove()
        handler.data['device'].remove()
        handler.disconnect()

    test.run(handle_connect, handle_command_insert)

    def handle_connect(handler):
        device, commands, command_ids = init_data(handler)
        device_1 = handler.api.get_device(device.id)
        device.remove()
        try:
            device_1.subscribe_insert_commands()
            assert False

# Path: devicehive/device.py
# class DeviceError(ApiRequestError):
#     """Device error."""
# 
# Path: devicehive/subscription.py
# class SubscriptionError(ApiRequestError):
#     """Subscription error."""
# 
# Path: devicehive/api_response.py
# class ApiResponseError(TransportError):
#     """Api response error."""
# 
#     def __init__(self, message, transport_name, code, error):
#         message = '%s Transport: %s. Code: %s. Error: %s' % (message,
#                                                              transport_name,
#                                                              code, error)
#         super(ApiResponseError, self).__init__(message)
#         self._transport_name = transport_name
#         self._code = code
#         self._error = error
# 
#     @property
#     def transport_name(self):
#         return self._transport_name
# 
#     @property
#     def code(self):
#         return self._code
# 
#     @property
#     def error(self):
#         return self._error


# Path: tests/test_api_device.py
from devicehive import DeviceError, SubscriptionError
from devicehive import ApiResponseError

            return
        handler.data['subscription'].remove()
        handler.data['device'].remove()
        handler.disconnect()

    test.run(handle_connect, handle_command_insert)

    def handle_connect(handler):
        device, command_names, command_ids = init_data(handler)
        command_name = command_names[:1]
        set_handler_data(handler, device, command_names, command_ids)
        send_data(handler, device, command_name)
        handler.data['subscription'] = device.subscribe_insert_commands(
            names=command_name)

    def handle_command_insert(handler, command):
        assert command.id == handler.data['command_ids'][0]
        handler.data['subscription'].remove()
        handler.data['device'].remove()
        handler.disconnect()

    test.run(handle_connect, handle_command_insert)

    def handle_connect(handler):
        device, commands, command_ids = init_data(handler)
        device_1 = handler.api.get_device(device.id)
        device.remove()
        try:
            device_1.subscribe_insert_commands()
            assert False

        except ApiResponseError as api_response_error: