ComfyUI: Log error details on prompt submission

b2b5c1f10cb04054c60e1337052a3252fb4d8568

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

1 files changed, +3 -2Ignore whitespace
src/endpoints/stable-diffusion.js+3 -2
@@ -7,7 +7,7 @@ import sanitize from 'sanitize-filename';
7import { sync as writeFileAtomicSync } from 'write-file-atomic';7import { sync as writeFileAtomicSync } from 'write-file-atomic';
8import FormData from 'form-data';8import FormData from 'form-data';
99
10import { delay, getBasicAuthHeader } from '../util.js';10import { delay, getBasicAuthHeader, tryParse } from '../util.js';
11import { jsonParser } from '../express-common.js';11import { jsonParser } from '../express-common.js';
12import { readSecret, SECRET_KEYS } from './secrets.js';12import { readSecret, SECRET_KEYS } from './secrets.js';
1313
@@ -535,7 +535,8 @@ comfy.post('/generate', jsonParser, async (request, response) => {
535 body: request.body.prompt,535 body: request.body.prompt,
536 });536 });
537 if (!promptResult.ok) {537 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) });
539 }540 }
540541
541 /** @type {any} */542 /** @type {any} */