mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-02-23 05:42:01 +01:00
Removed a nested try/catch that wasn't displaying all the informations.
Kept the outside try/catch that had better logging.
This commit is contained in:
parent
d6d4ce0ac4
commit
548149de8e
@ -487,13 +487,15 @@ async function doMakeImage(task) {
|
||||
let finalJSON = ''
|
||||
let prevTime = -1
|
||||
while (true) {
|
||||
try {
|
||||
let t = new Date().getTime()
|
||||
|
||||
const {value, done} = await reader.read()
|
||||
if (done && !finalJSON && !value) {
|
||||
break
|
||||
}
|
||||
|
||||
let timeTaken = (prevTime === -1 ? -1 : t - prevTime)
|
||||
let jsonStr = textDecoder.decode(value)
|
||||
let jsonStr = (value ? textDecoder.decode(value) : '')
|
||||
try {
|
||||
// hack for a middleman buffering all the streaming updates, and unleashing them on the poor browser in one shot.
|
||||
// this results in having to parse JSON like {"step": 1}{"step": 2}...{"status": "succeeded"..}
|
||||
@ -544,13 +546,7 @@ async function doMakeImage(task) {
|
||||
} else {
|
||||
finalJSON = jsonStr
|
||||
}
|
||||
|
||||
prevTime = t
|
||||
} catch (e) {
|
||||
logError('Stable Diffusion had an error. Please check the logs in the command-line window.', res, outputMsg)
|
||||
res = undefined
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
if (!res || res.status != 200 || !stepUpdate) {
|
||||
@ -585,11 +581,10 @@ async function doMakeImage(task) {
|
||||
logError('Stable Diffusion had an error. Please check the logs in the command-line window. <br/><br/>' + e + '<br/><pre>' + e.stack + '</pre>', res, outputMsg)
|
||||
setStatus('request', 'error', 'error')
|
||||
progressBar.style.display = 'none'
|
||||
res = undefined
|
||||
}
|
||||
|
||||
if (!stepUpdate) return false
|
||||
|
||||
if (!stepUpdate || stepUpdate.status !== 'succeeded') {
|
||||
return false
|
||||
}
|
||||
lastPromptUsed = reqBody['prompt']
|
||||
|
||||
showImages(reqBody, stepUpdate, outputContainer, false)
|
||||
|
Loading…
Reference in New Issue
Block a user