mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 12:47:08 +00:00
Update onvif error checking to use explict None check (#92642)
This commit is contained in:
parent
4a2af45e37
commit
c624e50b60
@ -17,16 +17,16 @@ def stringify_onvif_error(error: Exception) -> str:
|
||||
"""Stringify ONVIF error."""
|
||||
if isinstance(error, Fault):
|
||||
message = error.message
|
||||
if error.detail:
|
||||
if error.detail is not None: # checking true is deprecated
|
||||
# Detail may be a bytes object, so we need to convert it to string
|
||||
if isinstance(error.detail, bytes):
|
||||
detail = error.detail.decode("utf-8", "replace")
|
||||
else:
|
||||
detail = str(error.detail)
|
||||
message += ": " + detail
|
||||
if error.code:
|
||||
if error.code is not None: # checking true is deprecated
|
||||
message += f" (code:{error.code})"
|
||||
if error.subcodes:
|
||||
if error.subcodes is not None: # checking true is deprecated
|
||||
message += (
|
||||
f" (subcodes:{','.join(extract_subcodes_as_strings(error.subcodes))})"
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user