braid-http 1.3.14 → 1.3.15
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/braid-http-client.js +8 -1
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -226,6 +226,7 @@ async function braid_fetch (url, params = {}) {
|
|
|
226
226
|
var res = null
|
|
227
227
|
var subscription_cb = null
|
|
228
228
|
var subscription_error = null
|
|
229
|
+
var cb_running = false
|
|
229
230
|
|
|
230
231
|
return await new Promise((done, fail) => {
|
|
231
232
|
connect()
|
|
@@ -233,7 +234,11 @@ async function braid_fetch (url, params = {}) {
|
|
|
233
234
|
let on_error = e => {
|
|
234
235
|
on_error = () => {}
|
|
235
236
|
|
|
236
|
-
if (!params.retry ||
|
|
237
|
+
if (!params.retry ||
|
|
238
|
+
e.name === "AbortError" ||
|
|
239
|
+
e.startsWith?.('Parse error in headers') ||
|
|
240
|
+
cb_running) {
|
|
241
|
+
|
|
237
242
|
subscription_error?.(e)
|
|
238
243
|
return fail(e)
|
|
239
244
|
}
|
|
@@ -313,7 +318,9 @@ async function braid_fetch (url, params = {}) {
|
|
|
313
318
|
if (original_signal?.aborted) throw new DOMException('already aborted', 'AbortError')
|
|
314
319
|
|
|
315
320
|
// Yay! We got a new version! Tell the callback!
|
|
321
|
+
cb_running = true
|
|
316
322
|
cb(result)
|
|
323
|
+
cb_running = false
|
|
317
324
|
} else
|
|
318
325
|
// This error handling code runs if the connection
|
|
319
326
|
// closes, or if there is unparseable stuff in the
|