fix: Улучшена обработка ответа n8n в claim/create
- ✅ Проверка на пустой ответ - ✅ Подробное логирование тела ответа - ✅ Детальное сообщение об ошибке парсинга JSON
This commit is contained in:
@@ -160,8 +160,19 @@ async def proxy_create_claim(request: Request):
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
logger.info(f"✅ Claim created successfully")
|
||||
return response.json()
|
||||
response_text = response.text
|
||||
logger.info(f"✅ Claim created successfully. Response: {response_text[:200]}")
|
||||
|
||||
# Проверяем что ответ не пустой
|
||||
if not response_text or response_text.strip() == '':
|
||||
logger.error(f"❌ N8N returned empty response")
|
||||
raise HTTPException(status_code=500, detail="N8N вернул пустой ответ")
|
||||
|
||||
try:
|
||||
return response.json()
|
||||
except Exception as e:
|
||||
logger.error(f"❌ Failed to parse JSON: {e}. Response: {response_text[:500]}")
|
||||
raise HTTPException(status_code=500, detail=f"Ошибка парсинга ответа n8n: {str(e)}")
|
||||
else:
|
||||
logger.error(f"❌ N8N returned {response.status_code}: {response.text}")
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user