Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions homeassistant/components/onvif/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,11 @@ async def async_obtain_snapshot_uri(self):
req = media_service.create_type("GetSnapshotUri")
req.ProfileToken = profiles[self._profile_index].token

snapshot_uri = await media_service.GetSnapshotUri(req)
self._snapshot = snapshot_uri.Uri
try:
snapshot_uri = await media_service.GetSnapshotUri(req)
self._snapshot = snapshot_uri.Uri
except ServerDisconnectedError as err:
_LOGGER.debug("Camera does not support GetSnapshotUri: %s", err)
Comment on lines +414 to +418

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ONVIFError different than ServerDisconnectedError ? What can still raise ONVIFError ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need both exception. Here ServerDisconnectedErroris caught because the sever reset the connection. But if the onvif web server can answer but can't reply the right thing, it will raise ONVIFError as I understand.


_LOGGER.debug(
"ONVIF Camera Using the following URL for %s snapshot: %s",
Expand Down