Skip to content

Commit 3fe7e55

Browse files
claude[bot]zeke
andcommitted
feat: add debug logging for cog.current_scope() failures
Co-authored-by: Zeke Sikelianos <[email protected]>
1 parent 353e969 commit 3fe7e55

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/replicate/_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import httpx
2323

24+
from replicate._utils._logs import logger
2425
from replicate.lib._files import FileEncodingStrategy
2526
from replicate.lib._predictions_run import Model, Version, ModelVersionIdentifier
2627
from replicate.types.prediction_create_params import PredictionCreateParamsWithoutVersion
@@ -103,8 +104,8 @@ def _get_api_token_from_environment() -> str | None:
103104
if str(key).upper() == "REPLICATE_API_TOKEN":
104105
return str(value) if value is not None else value
105106

106-
except Exception: # Catch all exceptions to ensure robust fallback
107-
pass
107+
except Exception as e: # Catch all exceptions to ensure robust fallback
108+
logger.debug("Failed to retrieve API token from cog.current_scope(): %s", e)
108109

109110
return os.environ.get("REPLICATE_API_TOKEN")
110111

0 commit comments

Comments
 (0)