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

Catch an error that is reported, but silently ignored during CI testing #2665

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions changes/2665.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
An error raised and ignored during testbed testing on Winforms was silenced.
11 changes: 8 additions & 3 deletions winforms/src/toga_winforms/widgets/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,14 @@ def text(attr):

# TODO: ListView only has built-in support for one icon per row. One possible
# workaround is in https://stackoverflow.com/a/46128593.
icon = icon(self._accessors[0])
if icon is not None:
lvi.ImageIndex = self._image_index(icon)
try:
icon = icon(self._accessors[0])
except IndexError:
Copy link
Member

Choose a reason for hiding this comment

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

This could hide other IndexErrors from inside icon(), so in this case I think it's better to ask for permission rather than forgiveness.

# There's no _accessors, so there's no icon.
pass
else:
if icon is not None:
lvi.ImageIndex = self._image_index(icon)

return lvi

Expand Down
Loading