Skip to content

Commit

Permalink
instead of fail gracefully, pass a warning through logging. by loggin…
Browse files Browse the repository at this point in the history
…g default settings this warning should be displayed
  • Loading branch information
jason-weirather committed Sep 17, 2024
1 parent 47d31f0 commit 6261b29
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions comfy_cli/update.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import sys
import logging
from importlib.metadata import metadata

import requests
from packaging import version
from rich.console import Console
from rich.panel import Panel

# Set up a logger for the module
logger = logging.getLogger(__name__)

console = Console()


Expand All @@ -29,8 +33,9 @@ def check_for_newer_pypi_version(package_name: str, current_version: str, timeou
return True, latest_version

return False, current_version
except requests.RequestException:
# Fail quietly on timeout or any request exception
except requests.RequestException as e:
logger.warning(f"Unable to fetch {package_name} version metadata from PyPI. Retaining current version {current_version}. "
f"Exception: {type(e).__name__} - {e}")
return False, current_version


Expand Down

0 comments on commit 6261b29

Please sign in to comment.