fix(scrapeURL): error displaying

This commit is contained in:
Gergő Móricz 2024-11-07 23:18:24 +01:00
parent 79cadcb769
commit a297c99ba8
2 changed files with 2 additions and 3 deletions

View File

@ -64,7 +64,7 @@ export async function scrapeController(
} else {
return res.status(500).json({
success: false,
error: `(Internal server error) - ${e && e?.message ? e.message : e}`,
error: `(Internal server error) - ${(e && e.message) ? e.message : e}`,
});
}
}

View File

@ -488,8 +488,7 @@ async function processJob(job: Job & { id: string }, token: string) {
success: false,
document: null,
project_id: job.data.project_id,
error:
"Something went wrong... Contact help@mendable.ai or try again." /* etc... */,
error: error instanceof Error ? error : typeof error === "string" ? new Error(error) : new Error(JSON.stringify(error)),
};
if (!job.data.v1 && (job.data.mode === "crawl" || job.data.crawl_id)) {