braid-http 1.0.3 → 1.0.5
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 +6 -2
- package/package.json +1 -1
package/braid-http-client.js
CHANGED
|
@@ -235,7 +235,7 @@ async function braid_fetch (url, params = {}) {
|
|
|
235
235
|
// If parents is a function,
|
|
236
236
|
// call it now to get the latest parents
|
|
237
237
|
if (typeof params.parents === 'function') {
|
|
238
|
-
let parents = params.parents()
|
|
238
|
+
let parents = await params.parents()
|
|
239
239
|
if (parents) params.headers.set('parents', parents.map(JSON.stringify).join(', '))
|
|
240
240
|
}
|
|
241
241
|
|
|
@@ -350,7 +350,11 @@ async function braid_fetch (url, params = {}) {
|
|
|
350
350
|
case 504: // Gateway Timeout
|
|
351
351
|
give_up = false;
|
|
352
352
|
}
|
|
353
|
-
if (give_up)
|
|
353
|
+
if (give_up) {
|
|
354
|
+
let e = new Error(`giving up because of http status: ${res.status}${(res.status === 401 || res.status === 403) ? ` (access denied)` : ''}`)
|
|
355
|
+
subscription_error?.(e)
|
|
356
|
+
return fail(e)
|
|
357
|
+
}
|
|
354
358
|
if (!res.ok) throw new Error(`status not ok: ${res.status}`)
|
|
355
359
|
}
|
|
356
360
|
|