service2.js: Fix onFailedProofingResult not called on abort

This commit is contained in:
Simon Rozman 2024-05-21 18:30:04 +02:00
parent 67eee1015e
commit 49dc3385ea

View File

@ -88,7 +88,8 @@ class BesService {
* @param {Error} error Error * @param {Error} error Error
*/ */
onFailedProofingResult(error) { onFailedProofingResult(error) {
if (!this.proofingError) this.proofingError = error if (error !== 'AbortError' && !this.proofingError)
this.proofingError = error
if (--this.proofingCount <= 0) this.onEndProofing() if (--this.proofingCount <= 0) this.onEndProofing()
} }
@ -471,10 +472,7 @@ class BesDOMService extends BesService {
this.markProofed(node, matches) this.markProofed(node, matches)
this.onProofingProgress(matches.length) this.onProofingProgress(matches.length)
}) })
.catch(error => { .catch(error => this.onFailedProofingResult(error))
if (error.name === 'AbortError') return
this.onFailedProofingResult(error)
})
} }
return [{ text: `<${node.tagName}/>`, node: node, markup: true }] return [{ text: `<${node.tagName}/>`, node: node, markup: true }]
} else { } else {