@ledvance/base 1.3.108 → 1.3.110

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.
@@ -28,6 +28,10 @@ export interface DpReportSataData {
28
28
  value: string
29
29
  }
30
30
 
31
+ function isFrequencyLimitError(error) {
32
+ return error.errorCode === 'FREQUENCY_LIMIT_ERROR' || error.userInfo?.NSLocalizedFailureReason === 'FREQUENCY_LIMIT_ERROR'
33
+ }
34
+
31
35
  export async function getDpReportSataData(
32
36
  deviceId: string,
33
37
  dpIds: string[],
@@ -88,8 +92,7 @@ export async function getDpResultByMonth(
88
92
  error.errorCode === '103';
89
93
 
90
94
  // 对于特定的业务错误码也可以在这里添加判断
91
- const isFrequencyError = error.errorCode === 'FREQUENCY_LIMIT_ERROR';
92
- return isNetworkError || isFrequencyError;
95
+ return isNetworkError || isFrequencyLimitError(error);
93
96
  }
94
97
  }
95
98
  );
@@ -128,8 +131,7 @@ export async function getDataWithSpecified(
128
131
  error.errorCode === '103';
129
132
 
130
133
  // 对于特定的业务错误码也可以在这里添加判断
131
- const isFrequencyError = error.errorCode === 'FREQUENCY_LIMIT_ERROR';
132
- return isNetworkError || isFrequencyError;
134
+ return isNetworkError || isFrequencyLimitError(error);
133
135
  }
134
136
  }
135
137
  );
@@ -161,8 +163,7 @@ export async function getDpResultByHour(
161
163
  error.errorCode === '103';
162
164
 
163
165
  // 对于特定的业务错误码也可以在这里添加判断
164
- const isFrequencyError = error.errorCode === 'FREQUENCY_LIMIT_ERROR';
165
- return isNetworkError || isFrequencyError;
166
+ return isNetworkError || isFrequencyLimitError(error);
166
167
  }
167
168
  }
168
169
  );
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
2
  import {Utils} from 'tuya-panel-kit'
3
- import {store} from '../models'
3
+ import {store} from '@models'
4
4
  import I18n from '../i18n/index'
5
5
  import dayjs from "dayjs";
6
6
  import { NativeApi } from 'api/native';
@@ -224,6 +224,7 @@ export async function retryWithBackoff<T>(
224
224
  return await fn();
225
225
  } catch (error) {
226
226
  if (retries >= maxRetries || !shouldRetry(error)) {
227
+ xLog('不需要重试或超过最大重试次数', error)
227
228
  throw error;
228
229
  }
229
230
 
@@ -236,7 +237,7 @@ export async function retryWithBackoff<T>(
236
237
  const jitter = delay * 0.2 * Math.random();
237
238
  const actualDelay = delay + jitter;
238
239
 
239
- console.log(`请求失败,${retries}/${maxRetries} 次重试,等待 ${Math.round(actualDelay)}ms...`, error);
240
+ xLog(`请求失败,${retries}/${maxRetries} 次重试,等待 ${Math.round(actualDelay)}ms...`, error);
240
241
 
241
242
  // 等待延迟时间
242
243
  await new Promise(resolve => setTimeout(resolve, actualDelay));
@@ -279,7 +280,7 @@ export function callbackToPromise<T>(
279
280
  export function xLog(...args: any[]): void {
280
281
  // Call the original console.log with all arguments
281
282
  console.log(...args);
282
-
283
+
283
284
  // Convert all arguments to a single string for NativeApi.log
284
285
  // This preserves the formatting behavior similar to console.log
285
286
  const formattedMessage = args.map(arg => {
@@ -295,7 +296,7 @@ export function xLog(...args: any[]): void {
295
296
  // Handle other types directly
296
297
  return String(arg);
297
298
  }).join(' ');
298
-
299
+
299
300
  // Call NativeApi.log with the formatted string
300
301
  NativeApi.log(formattedMessage);
301
302
  }
package/translateKey.txt CHANGED
@@ -1294,4 +1294,5 @@ country_wales
1294
1294
  country_BA
1295
1295
  country_north_macedonia
1296
1296
  country_werder_bremen
1297
- reset_energy
1297
+ reset_energy
1298
+ thermostat_infotempcurve