mirror of
https://github.com/xtekky/gpt4free.git
synced 2025-12-06 02:30:41 -08:00
Enhance error logging for invalid G4F API keys by capturing exception details
This commit is contained in:
parent
ad9069f3ad
commit
01e7af68c0
1 changed files with 2 additions and 1 deletions
|
|
@ -257,8 +257,9 @@ class Api:
|
|||
if not data.get("user"):
|
||||
raise ValueError("User not found")
|
||||
user = data.get("user")
|
||||
except:
|
||||
except Exception as e:
|
||||
debug.log(f"Invalid G4F API key '{user_g4f_api_key[:6]}...' for user: '{user}'")
|
||||
debug.error(e)
|
||||
return ErrorResponse.from_message(f"Invalid G4F API key", HTTP_401_UNAUTHORIZED)
|
||||
expires = int(expires) - int(time.time())
|
||||
hours, remainder = divmod(expires, 3600)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue