Skip to content

location2cb/get_vans.py: improve error reporting #3

@fgalan

Description

@fgalan

Currently, the script doesn't handle error conditions due to LOCS unavailability, e.g.:

$ ./get_vans.py
Usage: python get_vans.py [period (default = 5 seconds)] [times (default once) (0 = forever)]
Technician A (34669079467):
Traceback (most recent call last):
  File "./get_vans.py", line 59, in <module>
    main()
  File "./get_vans.py", line 54, in main
    print_positions()
  File "./get_vans.py", line 28, in print_positions
    locs.get_location(locs.technician_A)
  File "/home/test2/fiware-livedemoapp/package/location2cb/locs_sim.py", line 260, in get_location
    longitude = location["terminalLocation"][0]["currentLocation"]["latitude"]
KeyError: 'currentLocation'

In this case, an error should be printed, e.g.:

$ ./get_vans.py
Usage: python get_vans.py [period (default = 5 seconds)] [times (default once) (0 = forever)]
LOCS service unavailable

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions