Skip to content

Commit

Permalink
Add function name to logs for easier debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
stacimc committed Sep 12, 2023
1 parent 0a33b5e commit 88da7ce
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions catalog/dags/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ def wrap(func: callable) -> callable:
media_type := signature(func).parameters.get("media_type")
) is None or media_type.kind != _ParameterKind.KEYWORD_ONLY:
raise Exception(
"Improperly configured: `media_type` must be a keyword-only argument"
f"Improperly configured function `{func.__qualname__}`:"
" `media_type` must be a keyword-only argument."
)

@functools.wraps(func)
Expand All @@ -57,7 +58,10 @@ def wrapped(*args, **kwargs):
media_type = kwargs.get("media_type", None)

if media_type not in values_by_media_type.keys():
raise ValueError(f"No values matching media type: {media_type}")
raise ValueError(
f"{func.__qualname__}: No values matching media type"
f" `{media_type}`"
)

# Get the value corresponding to the media type
media_info = values_by_media_type.get(media_type)
Expand Down

0 comments on commit 88da7ce

Please sign in to comment.