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

feat: add ImportError content to DispatchError #445

Merged
merged 1 commit into from
Jan 17, 2025
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
6 changes: 3 additions & 3 deletions simpleflow/dispatch/dynamic_dispatcher.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from simpleflow.activity import Activity
from simpleflow.utils import import_object_from_module
from simpleflow.utils import format_exc, import_object_from_module

from .exceptions import DispatchError

Expand All @@ -25,9 +25,9 @@ def dispatch_activity(name):
module_name, activity_name = name.rsplit(".", 1)
try:
activity = import_object_from_module(module_name, activity_name)
except ImportError:
except ImportError as e:
# We were not able to import a function at all.
raise DispatchError(f"unable to import '{name}'")
raise DispatchError(f"unable to import '{name}': {format_exc(e)}")
if not isinstance(activity, Activity):
# We managed to import a function (or callable) but it's not an
# "Activity". We will transform it into an Activity now. That way
Expand Down
Loading