Skip to content

Instantly share code, notes, and snippets.

@ZdenekM
Last active April 26, 2021 07:04
Show Gist options
  • Save ZdenekM/9d75f40a3314f409fea36efd8ab33b71 to your computer and use it in GitHub Desktop.
Save ZdenekM/9d75f40a3314f409fea36efd8ab33b71 to your computer and use it in GitHub Desktop.
How to get HTTP status code from SceneServiceException
from arcor2.clients import scene_service
from arcor2.rest import RestHttpException
try:
scene_service.start()
except scene_service.SceneServiceException as e:
if isinstance(e.__context__, RestHttpException):
print(e.__context__.error_code)
else:
print("HTTP status code not available.") # a non-HTTP related error occured
@ZdenekM
Copy link
Author

ZdenekM commented Apr 23, 2021

@Croolman here is the promised example. Test it out and please let me know if it is sufficient.

@Croolman
Copy link

@ZdenekM thank you. This approach works and is sufifcient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment