Skip to content

Commit

Permalink
Improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
const-cloudinary committed Jan 18, 2024
1 parent c756f56 commit 1d1b8f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cloudinary_cli/utils/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def call_api(func, args, kwargs):
try:
return func(*args, **kwargs)
except Exception as e:
log_exception(e, f"Failed calling '{func.__name__}' with args: {args} and optional args {kwargs}")
log_exception(e, debug_message=f"Failed calling '{func.__name__}' with args: {args} and optional args {kwargs}")
raise


Expand Down
5 changes: 3 additions & 2 deletions cloudinary_cli/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ def print_api_help(api, block_list=not_callable, allow_list=()):
logger.info(get_help_str(api, block_list=block_list, allow_list=allow_list))


def log_exception(e, message=None):
def log_exception(e, message=None, debug_message=None):
message = f"{message}, error: {str(e)}" if message is not None else str(e)
logger.debug(message, exc_info=True)
debug_message = debug_message or message
logger.debug(debug_message, exc_info=True)
logger.error(message)


Expand Down

0 comments on commit 1d1b8f9

Please sign in to comment.