Skip to content

Commit

Permalink
feat: add ImportError content to DispatchError
Browse files Browse the repository at this point in the history
Signed-off-by: Yves Bastide <[email protected]>
  • Loading branch information
ybastide committed Jan 16, 2025
1 parent 7d0b783 commit 978b1af
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 978b1af

Please sign in to comment.