Diagnose image worker failures and normalize Facebook uploads
This commit is contained in:
@@ -117,7 +117,15 @@ const server = createServer(async (req, res) => {
|
||||
} catch (error) {
|
||||
console.error("[ai-worker] job failed", error);
|
||||
if (error?.usageLimit) reply(429, { error: "Codex usage limit reached" });
|
||||
else reply(500, { error: "Automation failed; inspect worker logs and login" });
|
||||
else {
|
||||
const message = String(error?.message || "");
|
||||
const code = /foreground focus|Open normal Chrome/i.test(message) ? "DESKTOP_UNAVAILABLE"
|
||||
: /login required/i.test(message) ? "LOGIN_REQUIRED"
|
||||
: /composer unavailable|side panel did not open|extension side panel first/i.test(message) ? "CHAT_UNAVAILABLE"
|
||||
: /image.*(?:download|export|visible)|download.*finish/i.test(message) ? "IMAGE_EXPORT_FAILED"
|
||||
: "AUTOMATION_FAILED";
|
||||
reply(500, { error: "Automation failed; inspect worker logs", code });
|
||||
}
|
||||
} finally {
|
||||
if (dir) await rm(dir, { recursive: true, force: true });
|
||||
busy = false;
|
||||
|
||||
Reference in New Issue
Block a user