Skip to content

Commit

Permalink
Improve error debugging for invalid matches
Browse files Browse the repository at this point in the history
This needs to be printed to stdout, otherwise meson won't show it.
  • Loading branch information
whot committed Mar 26, 2024
1 parent e3a1e70 commit 9f54fcf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions test/test_udev_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ def pytest_generate_tests(metafunc):
if bus not in ['usb', 'bluetooth']:
continue

vid = int(vid, 16)
pid = int(pid, 16)
try:
vid = int(vid, 16)
pid = int(pid, 16)
except ValueError as e:
print(f"Invalid vid/pid in {match} in {f}", file=sys.stderr)
raise e

if bus == 'usb':
bus = 0x3
elif bus == 'bluetooth':
Expand Down
2 changes: 1 addition & 1 deletion tools/libwacom-update-db.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _load(self, path):
try:
bus, vid, pid, *_ = match.split(":")
except ValueError as e:
print(f"Failed to process match {match}")
print(f"Failed to process match {match} in {file}", file=sys.stderr)
raise e

name = config["Device"]["Name"]
Expand Down

0 comments on commit 9f54fcf

Please sign in to comment.