PluginProbe
Extendify / 3.2.2
Extendify v3.2.2
3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 All 128 releases
← All changes | src/AutoLaunch/functions/helpers.js +6 -4 3.0.4 → 3.2.2 View file →
@@ -1,6 +1,6 @@
1 1 import { useLaunchDataStore } from '@auto-launch/state/launch-data';
2 -import { __ } from '@wordpress/i18n';
2 +import { digest } from '@shared/api/digest';
3 3
4 4 export const setStatus = (msg) => {
5 5 useLaunchDataStore.getState().addStatusMessage(msg);
6 6 };
@@ -13,9 +13,9 @@
13 13 return await fn();
14 14 } catch (_) {
15 15 setErrorMessage(
16 16 // translators: This is an error message shown to the user when a network request fails and is being retried
17 - __('The network seems unstable. Retrying...', 'extendify-local'),
17 + launchStrings().errorUnstable,
18 18 );
19 19 await wait(1000);
20 20 const res = await fn();
21 21 setErrorMessage(null);
@@ -22,13 +22,14 @@
22 22 return res;
23 23 }
24 24 };
25 25
26 -export const failWithFallback = async (fn, fallback) => {
26 +export const failWithFallback = async (fn, fallback, errDetails = {}) => {
27 27 try {
28 28 return await fn();
29 29 } catch (error) {
30 - console.error('failWithFallback:', error);
30 + const { error: reported = error, ...details } = errDetails;
31 + digest({ error: reported, details: { source: 'auto-launch', ...details } });
31 32 return fallback;
32 33 }
33 34 };
34 35
@@ -33,8 +34,9 @@
33 34 };
34 35
35 36 export const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
36 37
38 +import { launchStrings } from '@auto-launch/strings';
37 39 import apiFetch from '@wordpress/api-fetch';
38 40
39 41 export async function apiFetchWithTimeout(options = {}, timeoutMs = 30000) {
40 42 const controller = new AbortController();