ComfyUI: Log error details on prompt submission

This commit is contained in:
Cohee 2024-11-18 20:35:48 +02:00
parent 87f2a9e630
commit b2b5c1f10c

View File

@ -7,7 +7,7 @@ import sanitize from 'sanitize-filename';
import { sync as writeFileAtomicSync } from 'write-file-atomic';
import FormData from 'form-data';
import { delay, getBasicAuthHeader } from '../util.js';
import { delay, getBasicAuthHeader, tryParse } from '../util.js';
import { jsonParser } from '../express-common.js';
import { readSecret, SECRET_KEYS } from './secrets.js';
@ -535,7 +535,8 @@ comfy.post('/generate', jsonParser, async (request, response) => {
body: request.body.prompt,
});
if (!promptResult.ok) {
throw new Error('ComfyUI returned an error.');
const text = await promptResult.text();
throw new Error('ComfyUI returned an error.', { cause: tryParse(text) });
}
/** @type {any} */