@akc42/app-utils 3.6.2 → 3.6.3
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/package.json +1 -1
- package/post-api.js +1 -0
package/package.json
CHANGED
package/post-api.js
CHANGED
|
@@ -52,6 +52,7 @@ export default async function api(url, params, blob, signal) {
|
|
|
52
52
|
}
|
|
53
53
|
} catch (err) {
|
|
54
54
|
if (!options.signal || !options.signal.aborted) {
|
|
55
|
+
if (err instanceof TypeError) throw new CustomEvent('api-network', { bubbles:true, composed:true, detail: address})
|
|
55
56
|
if (err.type === 'api-error') throw err; //just throw whatever error we had
|
|
56
57
|
//we failed to parse the json - the actual code should be in the text near the end;
|
|
57
58
|
throw new CustomEvent('api-error', { composed: true, bubbles: true, detail: {status:parseInt((text?? '---502---').slice(-6, -3), 10), url:address }});
|