Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ports without URLs should not raise an exception in update() #435

Open
eudoxos opened this issue Oct 14, 2023 · 0 comments
Open

Ports without URLs should not raise an exception in update() #435

eudoxos opened this issue Oct 14, 2023 · 0 comments

Comments

@eudoxos
Copy link

eudoxos commented Oct 14, 2023

The following lines retrieve url list from a port, but fail when there is no URL. I think this is legitimate (I double-checked with GCGetNumPortURLs and should be handled gracefully. Think of a NIC with no camera attached, or USB transport layer momentarily without camera — not a reason to crash, just the state of things at that moment:

try:
if len(port.url_info_list) > 0:
url = port.url_info_list[0].url
else:
raise LogicalErrorException(
'The target port does not hold any URL.')
except GenTL_GenericException:
return created_new_file, None

I suggest to say

except (GetnTL_GenericException, LogicalException):
   return create_new_file, None

which is handled gracefully by the caller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant