@flareapp/vite 2.7.0 → 2.8.0
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/dist/index.cjs +9 -4
- package/dist/index.mjs +9 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -16,6 +16,14 @@ const RETRIABLE_STATUS_CODES = new Set([
|
|
|
16
16
|
503,
|
|
17
17
|
504
|
|
18
18
|
]);
|
|
19
|
+
function describeNetworkError(error) {
|
|
20
|
+
if (!(error instanceof Error)) return String(error);
|
|
21
|
+
const cause = error.cause;
|
|
22
|
+
if (!(cause instanceof Error)) return error.message;
|
|
23
|
+
const code = cause.code;
|
|
24
|
+
const detail = typeof code === "string" ? `${code}: ${cause.message}` : cause.message;
|
|
25
|
+
return detail ? `${error.message} (${detail})` : error.message;
|
|
26
|
+
}
|
|
19
27
|
var FlareApi = class {
|
|
20
28
|
constructor(endpoint, key, version) {
|
|
21
29
|
this.endpoint = endpoint;
|
|
@@ -47,10 +55,7 @@ var FlareApi = class {
|
|
|
47
55
|
if (attempt === maxRetries) throw new FlareApiError(`Flare API returned ${response.status} after ${maxRetries} attempts`);
|
|
48
56
|
} catch (error) {
|
|
49
57
|
if (error instanceof FlareApiError) throw error;
|
|
50
|
-
if (attempt === maxRetries) {
|
|
51
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
52
|
-
throw new Error(`Network error after ${maxRetries} attempts: ${message}`, { cause: error });
|
|
53
|
-
}
|
|
58
|
+
if (attempt === maxRetries) throw new Error(`Network error after ${maxRetries} attempts: ${describeNetworkError(error)}`, { cause: error });
|
|
54
59
|
}
|
|
55
60
|
await this.delay(Math.pow(2, attempt - 1) * 1e3);
|
|
56
61
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -16,6 +16,14 @@ const RETRIABLE_STATUS_CODES = new Set([
|
|
|
16
16
|
503,
|
|
17
17
|
504
|
|
18
18
|
]);
|
|
19
|
+
function describeNetworkError(error) {
|
|
20
|
+
if (!(error instanceof Error)) return String(error);
|
|
21
|
+
const cause = error.cause;
|
|
22
|
+
if (!(cause instanceof Error)) return error.message;
|
|
23
|
+
const code = cause.code;
|
|
24
|
+
const detail = typeof code === "string" ? `${code}: ${cause.message}` : cause.message;
|
|
25
|
+
return detail ? `${error.message} (${detail})` : error.message;
|
|
26
|
+
}
|
|
19
27
|
var FlareApi = class {
|
|
20
28
|
constructor(endpoint, key, version) {
|
|
21
29
|
this.endpoint = endpoint;
|
|
@@ -47,10 +55,7 @@ var FlareApi = class {
|
|
|
47
55
|
if (attempt === maxRetries) throw new FlareApiError(`Flare API returned ${response.status} after ${maxRetries} attempts`);
|
|
48
56
|
} catch (error) {
|
|
49
57
|
if (error instanceof FlareApiError) throw error;
|
|
50
|
-
if (attempt === maxRetries) {
|
|
51
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
52
|
-
throw new Error(`Network error after ${maxRetries} attempts: ${message}`, { cause: error });
|
|
53
|
-
}
|
|
58
|
+
if (attempt === maxRetries) throw new Error(`Network error after ${maxRetries} attempts: ${describeNetworkError(error)}`, { cause: error });
|
|
54
59
|
}
|
|
55
60
|
await this.delay(Math.pow(2, attempt - 1) * 1e3);
|
|
56
61
|
}
|