Skip to content

Commit

Permalink
feat: add exception message pattern check for import errors
Browse files Browse the repository at this point in the history
  • Loading branch information
italojohnny committed Nov 25, 2024
1 parent 36e53f2 commit 10c8514
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import operator
import re
from typing import Any, ClassVar
from uuid import UUID

Expand Down Expand Up @@ -99,7 +100,11 @@ def build_template_config(self) -> dict:
return self.get_template_config(component_instance)

except AttributeError as e:
raise ImportError(e)
pattern = r"module '.*?' has no attribute '.*?'"
if re.search(pattern, str(e)):
raise ImportError(e) from e
raise
return {}

def build(self, *args: Any, **kwargs: Any) -> Any:
raise NotImplementedError

0 comments on commit 10c8514

Please sign in to comment.