Skip to content

get_resource_value: Wrong error returned when accessing not-existing device #336

@dimagr-arm

Description

@dimagr-arm

I installed the SDK using pip install command on my Windows PC.
I call get_resource_value API as described below:

api = ConnectAPI()
api.start_notifications()
value = api.get_resource_value(DEVICE_ID, WRITEABLE_RESOURCE)

If the DEVICE_ID string pointing to the not-existing device, the following error happens:

  File "set-resource-dima.py", line 33, in _main
    value = api.get_resource_value(DEVICE_ID, WRITEABLE_RESOURCE)
  File "C:\Python27\lib\site-packages\mbed_cloud\decorators.py", line 33,
in wrapped_f
    return fn(*args, **kwargs)
  File "C:\Python27\lib\site-packages\mbed_cloud\connect\connect.py", line
 302, in get_resource_value
    return self.get_resource_value_async(device_id, resource_path, fix_pat
h).wait(timeout)
AttributeError: 'NoneType' object has no attribute 'wait'

I expect to get a specific exception in this case and not AttributeError exception.

Note: if the DEVICE_ID string pointing to the existing device, the correct value is returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions