Skip to content

Commit

Permalink
Improve the error message for doImport failure
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Apr 8, 2022
1 parent 1c58548 commit fc7f16e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/lsst/utils/doImport.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ def tryImport(
# Move element from module to file and try again
infileComponents.insert(0, moduleComponents.pop())

raise ModuleNotFoundError(f"Unable to import {importable}")
# Fell through without success.
extra = f"({previousError})" if previousError is not None else ""
raise ModuleNotFoundError(f"Unable to import {importable!r} {extra}")


def doImportType(importable: str) -> Type:
Expand Down

0 comments on commit fc7f16e

Please sign in to comment.