Skip to content

Commit

Permalink
Improve error handling for cocoa menu probe.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Aug 24, 2023
1 parent a7f01e7 commit 847cf97
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cocoa/tests_backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,16 @@ def _menu_item(self, path):
while True:
label, path = path[0], path[1:]
item = menu.itemWithTitle(label)
if item is None:
raise AttributeError()
menu = item.submenu
except IndexError:
pass
except AttributeError:
raise AssertionError(f"Menu {' > '.join(orig_path)} not found")
raise AssertionError(
f"Menu {' > '.join(orig_path)} not found; menu {menu.title} has items "
+ ",".join(f"{item.title!r}" for item in menu.itemArray)
)

return item

Expand Down

0 comments on commit 847cf97

Please sign in to comment.