ComfyUI: Log error details on prompt submission

b2b5c1f10cb04054c60e1337052a3252fb4d8568

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +3 -2Showing whitespace changes
src/endpoints/stable-diffusion.js+3 -2
@@ -7,7 +7,7 @@ import sanitize from 'sanitize-filename';
77import { sync as writeFileAtomicSync } from 'write-file-atomic';
88import FormData from 'form-data';
99
1010import { delay, getBasicAuthHeader, tryParse } from '../util.js';
1111import { jsonParser } from '../express-common.js';
1212import { readSecret, SECRET_KEYS } from './secrets.js';
1313
@@ -535,7 +535,8 @@ comfy.post('/generate', jsonParser, async (request, response) => {
535535 body: request.body.prompt,
536536 });
537537 if (!promptResult.ok) {
538- throw new Error('ComfyUI returned an error.');
538+ const text = await promptResult.text();
539+ throw new Error('ComfyUI returned an error.', { cause: tryParse(text) });
539540 }
540541
541542 /** @type {any} */