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

source shell improve error message when a import inside the source script fails #2908

Merged
Merged
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,15 @@ def create(
source_module: SourceModule = importlib.import_module(
f"waste_collection_schedule.source.{source_name}"
)
except ImportError:
_LOGGER.error(f"source not found: {source_name}")
except ImportError as e:
if str(e).startswith(
f"No module named 'waste_collection_schedule.source.{source_name}'"
):
_LOGGER.error(f"source not found: {source_name}")
else:
_LOGGER.error(
f"error loading source {source_name}:\n{e} \n{traceback.format_exc()}"
)
return None

# create source
Expand Down