debug: expose whisk response details to UI error

This commit is contained in:
Khoa.vo 2025-12-30 20:42:38 +07:00
parent 22a374525e
commit f336b25f13

View file

@ -246,12 +246,14 @@ def load_template_favorites():
if not images:
import json
logger.error(f"WHISK DEBUG - Full Response: {json.dumps(json_resp)}")
debug_info = json.dumps(json_resp)
# check for common non-standard errors
if 'error' in json_resp:
err_msg = json_resp['error']
raise WhiskClientError(f"Whisk API returned error: {err_msg}")
raise WhiskClientError(f"Whisk Error: {err_msg} | Valid Cookies? Check logs.")
raise WhiskClientError(f"No images found in response. Response keys: {list(json_resp.keys())}")
# Return the full structure in the error so user can see it in UI
raise WhiskClientError(f"Whisk API returned NO IMAGES. Google says: {debug_info}")
return base64.b64decode(images[0])