koishi-plugin-p-draw 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +17 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1331,7 +1331,23 @@ exports.apply = async function apply(ctx, cfg) {
|
|
|
1331
1331
|
body: JSON.stringify(body),
|
|
1332
1332
|
signal: controller.signal,
|
|
1333
1333
|
})
|
|
1334
|
-
if (!res.ok)
|
|
1334
|
+
if (!res.ok) {
|
|
1335
|
+
// ComfyUI /prompt 校验失败时会返回 node_errors 等详细错误,尽量带出来便于排查
|
|
1336
|
+
const text = await res.text().catch(() => '')
|
|
1337
|
+
const detail = (() => {
|
|
1338
|
+
try {
|
|
1339
|
+
const data = JSON.parse(text)
|
|
1340
|
+
if (data && data.error) {
|
|
1341
|
+
const extra = data.error.extra_info && data.error.extra_info.node_errors
|
|
1342
|
+
? Object.entries(data.error.extra_info.node_errors).map(([id, e]) => `${id}:${e.class_type || ''} → ${e.errors ? e.errors.map(x => (x && x.message) || JSON.stringify(x)).join('; ') : JSON.stringify(e)}`).join('\n')
|
|
1343
|
+
: ''
|
|
1344
|
+
return `${data.error.message || ''}${data.error.details ? ' ' + data.error.details : ''}${extra ? '\n' + extra : ''}`.trim()
|
|
1345
|
+
}
|
|
1346
|
+
} catch (e) { /* ignore */ }
|
|
1347
|
+
return text.slice(0, 500)
|
|
1348
|
+
})()
|
|
1349
|
+
throw new Error(`HTTP ${res.status}${detail ? ':' + detail : ''}`)
|
|
1350
|
+
}
|
|
1335
1351
|
return await res.json()
|
|
1336
1352
|
} finally {
|
|
1337
1353
|
clearTimeout(timer)
|