fansunited-widget-client-configuration 1.6.0 → 1.7.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fansunited-widget-client-configuration",
3
- "version": "1.6.0",
3
+ "version": "1.7.1",
4
4
  "main": "configuration-manager.es.js",
5
5
  "author": "Fans United",
6
6
  "description": "",
@@ -0,0 +1,27 @@
1
+ interface APIErrorResponse {
2
+ error: {
3
+ code: number;
4
+ status: string;
5
+ message: string;
6
+ };
7
+ }
8
+ /**
9
+ * Extracts the appropriate error message from an API error response
10
+ *
11
+ * @param errorData - The parsed API error response object
12
+ * @param fallbackMessage - The generic error message to use for 500 errors or when API message is unavailable
13
+ * @returns The error message to display
14
+ *
15
+ * @example
16
+ * const response = await https.getWidgetConfigurations();
17
+ * const data = await response.json();
18
+ *
19
+ * if (response.ok) {
20
+ * // handle success data
21
+ * } else {
22
+ * const errorMessage = getErrorMessage(data, 'Failed to fetch configurations');
23
+ * displayToast('danger', errorMessage);
24
+ * }
25
+ */
26
+ export declare function getErrorMessage(errorData: APIErrorResponse, fallbackMessage: string): string;
27
+ export {};