Skip to content

Commit 0b1f89e

Browse files
chengzeyiclaude
andcommitted
Add error handling for failed sync mode predictions
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e5f8f87 commit 0b1f89e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/wavespeed/api/client.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,15 @@ def run(
312312

313313
if enable_sync_mode:
314314
# In sync mode, extract outputs from the result
315+
status = sync_result.get("data", {}).get("status")
316+
if status != "completed":
317+
error = (
318+
sync_result.get("data", {}).get("error") or "Unknown error"
319+
)
320+
request_id = sync_result.get("data", {}).get("id", "unknown")
321+
raise RuntimeError(
322+
f"Prediction failed (task_id: {request_id}): {error}"
323+
)
315324
data = sync_result.get("data", {})
316325
return {"outputs": data.get("outputs", [])}
317326

0 commit comments

Comments
 (0)