diff --git a/service_desk/handlers.py b/service_desk/handlers.py index 33b7d2e..79b960b 100644 --- a/service_desk/handlers.py +++ b/service_desk/handlers.py @@ -178,7 +178,10 @@ async def create_ticket_in_sd(requester_email: str, subject: str, description: s if template_id: req_payload["request"]["request_template"] = {"id": template_id} async with httpx.AsyncClient(verify=False) as client: - return await client.post(endpoint, headers=headers, json={"input_data": req_payload}, timeout=15.0) + resp = await client.post(endpoint, headers=headers, json={"input_data": req_payload}, timeout=15.0) + if resp.status_code not in [200, 201]: + sd_workflow_logger.error(f"API Error: status={resp.status_code} body={resp.text}") + return resp resp = await _send_req(requester_email, city) data = resp.json() if resp.status_code in [200, 201] else {} if data.get("response_status", {}).get("status_code") != 2000: