From 747a86bb94006aaca721cfc0c0ce7061643a9ea6 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 20 八月 2026 12:19:35 +0800
Subject: [PATCH] gx
---
aliyun-service.js | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/aliyun-service.js b/aliyun-service.js
index 3d10bca..df0e1c7 100644
--- a/aliyun-service.js
+++ b/aliyun-service.js
@@ -63,7 +63,7 @@
const normalized = this.normalizeEventPayload(errorLike);
if (normalized instanceof Error) {
- return normalized.message || normalized.name || 'unknown-error';
+ return normalized.message || normalized.name || '未知错误';
}
if (Array.isArray(normalized)) {
@@ -71,7 +71,7 @@
.map((item) => this.formatErrorMessage(item))
.filter(Boolean);
- return parts.length > 0 ? parts.join(' | ') : 'unknown-error';
+ return parts.length > 0 ? parts.join(' | ') : '未知错误';
}
if (normalized && typeof normalized === 'object') {
@@ -87,7 +87,7 @@
}
if (normalized === undefined || normalized === null || normalized === '') {
- return 'unknown-error';
+ return '未知错误';
}
return String(normalized);
@@ -139,7 +139,7 @@
return this.aliyunSdk;
}
- // eslint-disable-next-line global-require
+ // 延迟加载 SDK,避免未启用阿里云时引入额外依赖。
this.aliyunSdk = require('aliyun-iot-device-sdk');
return this.aliyunSdk;
}
@@ -219,7 +219,7 @@
try {
responseBody = JSON.parse(rawText);
} catch (_error) {
- throw new Error('三元组接口返回不是有效 JSON');
+ throw new Error('三元组接口返回的不是有效 JSON');
}
return this.extractTuple(responseBody, deviceId);
@@ -241,7 +241,7 @@
if (context.lastRegisterAttempt > 0 && (now - context.lastRegisterAttempt) < retryMs && context.lastRegisterError) {
this.logger.warn(`[ALIYUN] 三元组请求冷却中 deviceId=${device.deviceId} retryMs=${retryMs} lastError=${context.lastRegisterError}`);
- throw new Error(`阿里云三元组重试冷却中 ${context.lastRegisterError}`);
+ throw new Error(`阿里云三元组重试冷却中: ${context.lastRegisterError}`);
}
context.lastRegisterAttempt = now;
--
Gitblit v1.8.0