@flareapp/webpack 2.7.0 → 2.9.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 CHANGED
@@ -46,6 +46,14 @@ const RETRIABLE_STATUS_CODES = new Set([
46
46
  503,
47
47
  504
48
48
  ]);
49
+ function describeNetworkError(error) {
50
+ if (!(error instanceof Error)) return String(error);
51
+ const cause = error.cause;
52
+ if (!(cause instanceof Error)) return error.message;
53
+ const code = cause.code;
54
+ const detail = typeof code === "string" ? `${code}: ${cause.message}` : cause.message;
55
+ return detail ? `${error.message} (${detail})` : error.message;
56
+ }
49
57
  var FlareApi = class {
50
58
  constructor(endpoint, key, version) {
51
59
  this.endpoint = endpoint;
@@ -77,10 +85,7 @@ var FlareApi = class {
77
85
  if (attempt === maxRetries) throw new FlareApiError(`Flare API returned ${response.status} after ${maxRetries} attempts`);
78
86
  } catch (error) {
79
87
  if (error instanceof FlareApiError) throw error;
80
- if (attempt === maxRetries) {
81
- const message = error instanceof Error ? error.message : String(error);
82
- throw new Error(`Network error after ${maxRetries} attempts: ${message}`, { cause: error });
83
- }
88
+ if (attempt === maxRetries) throw new Error(`Network error after ${maxRetries} attempts: ${describeNetworkError(error)}`, { cause: error });
84
89
  }
85
90
  await this.delay(Math.pow(2, attempt - 1) * 1e3);
86
91
  }
package/dist/index.mjs CHANGED
@@ -17,6 +17,14 @@ const RETRIABLE_STATUS_CODES = new Set([
17
17
  503,
18
18
  504
19
19
  ]);
20
+ function describeNetworkError(error) {
21
+ if (!(error instanceof Error)) return String(error);
22
+ const cause = error.cause;
23
+ if (!(cause instanceof Error)) return error.message;
24
+ const code = cause.code;
25
+ const detail = typeof code === "string" ? `${code}: ${cause.message}` : cause.message;
26
+ return detail ? `${error.message} (${detail})` : error.message;
27
+ }
20
28
  var FlareApi = class {
21
29
  constructor(endpoint, key, version) {
22
30
  this.endpoint = endpoint;
@@ -48,10 +56,7 @@ var FlareApi = class {
48
56
  if (attempt === maxRetries) throw new FlareApiError(`Flare API returned ${response.status} after ${maxRetries} attempts`);
49
57
  } catch (error) {
50
58
  if (error instanceof FlareApiError) throw error;
51
- if (attempt === maxRetries) {
52
- const message = error instanceof Error ? error.message : String(error);
53
- throw new Error(`Network error after ${maxRetries} attempts: ${message}`, { cause: error });
54
- }
59
+ if (attempt === maxRetries) throw new Error(`Network error after ${maxRetries} attempts: ${describeNetworkError(error)}`, { cause: error });
55
60
  }
56
61
  await this.delay(Math.pow(2, attempt - 1) * 1e3);
57
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flareapp/webpack",
3
- "version": "2.7.0",
3
+ "version": "2.9.0",
4
4
  "description": "Webpack plugin for uploading sourcemaps to Flare",
5
5
  "homepage": "https://flareapp.io",
6
6
  "bugs": "https://github.com/spatie/flare-client-js/issues",