Skip to content

Commit

Permalink
more granular error messages
Browse files Browse the repository at this point in the history
Signed-off-by: govinda-kamath <[email protected]>
  • Loading branch information
govinda-kamath committed Oct 21, 2024
1 parent 797ea3d commit 967846a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions openslide/lowlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,14 @@ def _load_library() -> CDLL:
pass

def try_load(names: list[str]) -> CDLL:
error_strings = []
for name in names:
try:
return cdll.LoadLibrary(name)
except OSError:
except OSError as err:
error_strings.append(f"{name}: {err}")
if name == names[-1]:
raise
raise OSError("\n".join(error_strings))
else:
raise ValueError('No library names specified')

Expand Down

0 comments on commit 967846a

Please sign in to comment.