Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

pydantic-parsing-error-handling

Gaurav Chadha5ea2c3a9289a
diff --git a/apps/api/src/controllers/v1/extract-status.ts b/apps/api/src/controllers/v1/extract-status.ts
index 8a3e27386..4a61cdc7a 100644
--- a/apps/api/src/controllers/v1/extract-status.ts
+++ b/apps/api/src/controllers/v1/extract-status.ts
@@ -116,7 +116,7 @@ export async function extractStatusController(
success: status === "failed" ? false : true,
data,
status,
- error: extract?.error ?? undefined,
+ error: typeof extract?.error === "string" ? extract.error : undefined,
expiresAt: (await getExtractExpiry(req.params.jobId)).toISOString(),
steps: extract?.showSteps ? extract.steps : undefined,
llmUsage: extract?.showLLMUsage ? extract.llmUsage : undefined,
diff --git a/apps/api/src/controllers/v2/extract-status.ts b/apps/api/src/controllers/v2/extract-status.ts
index 3d9ae5111..f640a14b0 100644
--- a/apps/api/src/controllers/v2/extract-status.ts
+++ b/apps/api/src/controllers/v2/extract-status.ts
@@ -116,7 +116,7 @@ export async function extractStatusController(
success: status === "failed" ? false : true,
data,
status,
- error: extract?.error ?? undefined,
+ error: typeof extract?.error === "string" ? extract.error : undefined,
expiresAt: (await getExtractExpiry(req.params.jobId)).toISOString(),
steps: extract?.showSteps ? extract.steps : undefined,
llmUsage: extract?.showLLMUsage ? extract.llmUsage : undefined,