提交 2cdf4cad 编写于 作者: zyjhandsome's avatar zyjhandsome

优化部分error异常日志打印

Signed-off-by: zyjhandsome's avatarzyjhandsome <zyjhandsome@126.com>
上级 1aeebe05
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
## 接口说明 ## 接口说明
[isSupportTemplate()](../reference/apis/js-apis-notificationManager.md#notificationissupporttemplate)是查询模板是否支持接口,目前仅支持进度条模板。 [isSupportTemplate()](../reference/apis/js-apis-notificationManager.md#notificationmanagerissupporttemplate)是查询模板是否支持接口,目前仅支持进度条模板。
| **接口名** | **描述** | | **接口名** | **描述** |
| -------- | -------- | | -------- | -------- |
......
...@@ -292,7 +292,7 @@ let subscribeInfo = { ...@@ -292,7 +292,7 @@ let subscribeInfo = {
//订阅公共事件回调 //订阅公共事件回调
function subscribeCB(err, data) { function subscribeCB(err, data) {
if (err.code) { if (err.code) {
console.error("subscribe failed " + JSON.stringify(err)); console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("subscribe " + JSON.stringify(data)); console.info("subscribe " + JSON.stringify(data));
} }
......
...@@ -576,7 +576,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi ...@@ -576,7 +576,7 @@ addSlots(slots: Array\<NotificationSlot\>, callback: AsyncCallback\<void\>): voi
// addSlots回调 // addSlots回调
function addSlotsCallBack(err) { function addSlotsCallBack(err) {
if (err) { if (err) {
console.info("addSlots failed " + JSON.stringify(err)); console.error(`addSlots failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("addSlots success"); console.info("addSlots success");
} }
...@@ -737,7 +737,7 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void ...@@ -737,7 +737,7 @@ getSlots(callback: AsyncCallback<Array\<NotificationSlot\>>): void
// getSlots回调 // getSlots回调
function getSlotsCallback(err,data) { function getSlotsCallback(err,data) {
if (err) { if (err) {
console.info("getSlots failed " + JSON.stringify(err)); console.error(`getSlots failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlots success"); console.info("getSlots success");
} }
...@@ -871,7 +871,7 @@ removeAllSlots(callback: AsyncCallback\<void\>): void ...@@ -871,7 +871,7 @@ removeAllSlots(callback: AsyncCallback\<void\>): void
```ts ```ts
function removeAllCallBack(err) { function removeAllCallBack(err) {
if (err) { if (err) {
console.info("removeAllSlots failed " + JSON.stringify(err)); console.error(`removeAllSlots failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeAllSlots success"); console.info("removeAllSlots success");
} }
...@@ -937,7 +937,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall ...@@ -937,7 +937,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall
```ts ```ts
function setNotificationEnablenCallback(err) { function setNotificationEnablenCallback(err) {
if (err) { if (err) {
console.info("setNotificationEnablenCallback failed " + JSON.stringify(err)); console.error(`setNotificationEnablenCallback failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setNotificationEnablenCallback success"); console.info("setNotificationEnablenCallback success");
} }
...@@ -1020,7 +1020,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>): ...@@ -1020,7 +1020,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean\>):
```ts ```ts
function isNotificationEnabledCallback(err, data) { function isNotificationEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationEnabled failed " + JSON.stringify(err)); console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isNotificationEnabled success"); console.info("isNotificationEnabled success");
} }
...@@ -1106,7 +1106,7 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void ...@@ -1106,7 +1106,7 @@ isNotificationEnabled(callback: AsyncCallback\<boolean\>): void
```ts ```ts
function isNotificationEnabledCallback(err, data) { function isNotificationEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationEnabled failed " + JSON.stringify(err)); console.error(`isNotificationEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isNotificationEnabled success"); console.info("isNotificationEnabled success");
} }
...@@ -1190,7 +1190,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi ...@@ -1190,7 +1190,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<voi
```ts ```ts
function displayBadgeCallback(err) { function displayBadgeCallback(err) {
if (err) { if (err) {
console.info("displayBadge failed " + JSON.stringify(err)); console.error(`displayBadge failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("displayBadge success"); console.info("displayBadge success");
} }
...@@ -1273,7 +1273,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void ...@@ -1273,7 +1273,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean\>): void
```ts ```ts
function isBadgeDisplayedCallback(err, data) { function isBadgeDisplayedCallback(err, data) {
if (err) { if (err) {
console.info("isBadgeDisplayed failed " + JSON.stringify(err)); console.error(`isBadgeDisplayed failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isBadgeDisplayed success"); console.info("isBadgeDisplayed success");
} }
...@@ -1362,7 +1362,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal ...@@ -1362,7 +1362,7 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
```ts ```ts
function setSlotByBundleCallback(err) { function setSlotByBundleCallback(err) {
if (err) { if (err) {
console.info("setSlotByBundle failed " + JSON.stringify(err)); console.error(`setSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setSlotByBundle success"); console.info("setSlotByBundle success");
} }
...@@ -1451,7 +1451,7 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati ...@@ -1451,7 +1451,7 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback<Array\<Notificati
```ts ```ts
function getSlotsByBundleCallback(err, data) { function getSlotsByBundleCallback(err, data) {
if (err) { if (err) {
console.info("getSlotsByBundle failed " + JSON.stringify(err)); console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlotsByBundle success"); console.info("getSlotsByBundle success");
} }
...@@ -1539,7 +1539,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi ...@@ -1539,7 +1539,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number\>): voi
```ts ```ts
function getSlotNumByBundleCallback(err, data) { function getSlotNumByBundleCallback(err, data) {
if (err) { if (err) {
console.info("getSlotNumByBundle failed " + JSON.stringify(err)); console.error(`getSlotByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getSlotNumByBundle success"); console.info("getSlotNumByBundle success");
} }
...@@ -1626,7 +1626,7 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>) ...@@ -1626,7 +1626,7 @@ getAllActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>)
```ts ```ts
function getAllActiveNotificationsCallback(err, data) { function getAllActiveNotificationsCallback(err, data) {
if (err) { if (err) {
console.info("getAllActiveNotifications failed " + JSON.stringify(err)); console.error(`getAllActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getAllActiveNotifications success"); console.info("getAllActiveNotifications success");
} }
...@@ -1696,7 +1696,7 @@ getActiveNotificationCount(callback: AsyncCallback\<number\>): void ...@@ -1696,7 +1696,7 @@ getActiveNotificationCount(callback: AsyncCallback\<number\>): void
```ts ```ts
function getActiveNotificationCountCallback(err, data) { function getActiveNotificationCountCallback(err, data) {
if (err) { if (err) {
console.info("getActiveNotificationCount failed " + JSON.stringify(err)); console.error(`getActiveNotificationCount failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getActiveNotificationCount success"); console.info("getActiveNotificationCount success");
} }
...@@ -1762,7 +1762,7 @@ getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): v ...@@ -1762,7 +1762,7 @@ getActiveNotifications(callback: AsyncCallback<Array\<NotificationRequest\>>): v
```ts ```ts
function getActiveNotificationsCallback(err, data) { function getActiveNotificationsCallback(err, data) {
if (err) { if (err) {
console.info("getActiveNotifications failed " + JSON.stringify(err)); console.error(`getActiveNotifications failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getActiveNotifications success"); console.info("getActiveNotifications success");
} }
...@@ -1829,7 +1829,7 @@ cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void ...@@ -1829,7 +1829,7 @@ cancelGroup(groupName: string, callback: AsyncCallback\<void\>): void
```ts ```ts
function cancelGroupCallback(err) { function cancelGroupCallback(err) {
if (err) { if (err) {
console.info("cancelGroup failed " + JSON.stringify(err)); console.error(`cancelGroup failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancelGroup success"); console.info("cancelGroup success");
} }
...@@ -1905,7 +1905,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall ...@@ -1905,7 +1905,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
```ts ```ts
function removeGroupByBundleCallback(err) { function removeGroupByBundleCallback(err) {
if (err) { if (err) {
console.info("removeGroupByBundle failed " + JSON.stringify(err)); console.error(`removeGroupByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("removeGroupByBundle success"); console.info("removeGroupByBundle success");
} }
...@@ -1987,7 +1987,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo ...@@ -1987,7 +1987,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void\>): vo
```ts ```ts
function setDoNotDisturbDateCallback(err) { function setDoNotDisturbDateCallback(err) {
if (err) { if (err) {
console.info("setDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setDoNotDisturbDate success"); console.info("setDoNotDisturbDate success");
} }
...@@ -2076,7 +2076,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb ...@@ -2076,7 +2076,7 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb
```ts ```ts
function setDoNotDisturbDateCallback(err) { function setDoNotDisturbDateCallback(err) {
if (err) { if (err) {
console.info("setDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`setDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setDoNotDisturbDate success"); console.info("setDoNotDisturbDate success");
} }
...@@ -2169,7 +2169,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void ...@@ -2169,7 +2169,7 @@ getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate\>): void
```ts ```ts
function getDoNotDisturbDateCallback(err,data) { function getDoNotDisturbDateCallback(err,data) {
if (err) { if (err) {
console.info("getDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getDoNotDisturbDate success"); console.info("getDoNotDisturbDate success");
} }
...@@ -2246,7 +2246,7 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>) ...@@ -2246,7 +2246,7 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate\>)
```ts ```ts
function getDoNotDisturbDateCallback(err,data) { function getDoNotDisturbDateCallback(err,data) {
if (err) { if (err) {
console.info("getDoNotDisturbDate failed " + JSON.stringify(err)); console.error(`getDoNotDisturbDate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getDoNotDisturbDate success"); console.info("getDoNotDisturbDate success");
} }
...@@ -2332,7 +2332,7 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void ...@@ -2332,7 +2332,7 @@ supportDoNotDisturbMode(callback: AsyncCallback\<boolean\>): void
```ts ```ts
function supportDoNotDisturbModeCallback(err,data) { function supportDoNotDisturbModeCallback(err,data) {
if (err) { if (err) {
console.info("supportDoNotDisturbMode failed " + JSON.stringify(err)); console.error(`supportDoNotDisturbMode failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("supportDoNotDisturbMode success"); console.info("supportDoNotDisturbMode success");
} }
...@@ -2405,7 +2405,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): voi ...@@ -2405,7 +2405,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean\>): voi
let templateName = 'process'; let templateName = 'process';
function isSupportTemplateCallback(err, data) { function isSupportTemplateCallback(err, data) {
if (err) { if (err) {
console.info("isSupportTemplate failed " + JSON.stringify(err)); console.error(`isSupportTemplate failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isSupportTemplate success"); console.info("isSupportTemplate success");
} }
...@@ -2480,7 +2480,7 @@ requestEnableNotification(callback: AsyncCallback\<void\>): void ...@@ -2480,7 +2480,7 @@ requestEnableNotification(callback: AsyncCallback\<void\>): void
```javascript ```javascript
function requestEnableNotificationCallback(err) { function requestEnableNotificationCallback(err) {
if (err) { if (err) {
console.info("requestEnableNotification failed " + JSON.stringify(err)); console.error(`requestEnableNotification failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("requestEnableNotification success"); console.info("requestEnableNotification success");
} }
...@@ -2548,7 +2548,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\<void\>): void ...@@ -2548,7 +2548,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\<void\>): void
```javascript ```javascript
function setDistributedEnableCallback() { function setDistributedEnableCallback() {
if (err) { if (err) {
console.info("setDistributedEnable failed " + JSON.stringify(err)); console.error(`setDistributedEnable failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setDistributedEnable success"); console.info("setDistributedEnable success");
} }
...@@ -2625,7 +2625,7 @@ isDistributedEnabled(callback: AsyncCallback\<boolean>): void ...@@ -2625,7 +2625,7 @@ isDistributedEnabled(callback: AsyncCallback\<boolean>): void
```javascript ```javascript
function isDistributedEnabledCallback(err, data) { function isDistributedEnabledCallback(err, data) {
if (err) { if (err) {
console.info("isDistributedEnabled failed " + JSON.stringify(err)); console.error(`isDistributedEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isDistributedEnabled success " + JSON.stringify(data)); console.info("isDistributedEnabled success " + JSON.stringify(data));
} }
...@@ -2704,7 +2704,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As ...@@ -2704,7 +2704,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As
```javascript ```javascript
function setDistributedEnableByBundleCallback(err) { function setDistributedEnableByBundleCallback(err) {
if (err) { if (err) {
console.info("enableDistributedByBundle failed " + JSON.stringify(err)); console.error(`setDistributedEnableByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("enableDistributedByBundle success"); console.info("enableDistributedByBundle success");
} }
...@@ -2798,7 +2798,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool ...@@ -2798,7 +2798,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<bool
```javascript ```javascript
function isDistributedEnabledByBundleCallback(data) { function isDistributedEnabledByBundleCallback(data) {
if (err) { if (err) {
console.info("isDistributedEnabledByBundle failed " + JSON.stringify(err)); console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isDistributedEnabledByBundle success" + JSON.stringify(data)); console.info("isDistributedEnabledByBundle success" + JSON.stringify(data));
} }
...@@ -2889,7 +2889,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void ...@@ -2889,7 +2889,7 @@ getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType\>): void
```javascript ```javascript
function getDeviceRemindTypeCallback(err, data) { function getDeviceRemindTypeCallback(err, data) {
if (err) { if (err) {
console.info("getDeviceRemindType failed " + JSON.stringify(err)); console.error(`getDeviceRemindType failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("getDeviceRemindType success"); console.info("getDeviceRemindType success");
} }
...@@ -2972,7 +2972,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user ...@@ -2972,7 +2972,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user
//publishAsBundle回调 //publishAsBundle回调
function callback(err) { function callback(err) {
if (err) { if (err) {
console.info("publishAsBundle failed " + JSON.stringify(err)); console.error(`publishAsBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("publishAsBundle success"); console.info("publishAsBundle success");
} }
...@@ -3094,7 +3094,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac ...@@ -3094,7 +3094,7 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac
// cancelAsBundle // cancelAsBundle
function cancelAsBundleCallback(err) { function cancelAsBundleCallback(err) {
if (err) { if (err) {
console.info("cancelAsBundle failed " + JSON.stringify(err)); console.error(`cancelAsBundle failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("cancelAsBundle success"); console.info("cancelAsBundle success");
} }
...@@ -3188,7 +3188,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, ...@@ -3188,7 +3188,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean,
// setNotificationEnableSlot // setNotificationEnableSlot
function setNotificationEnableSlotCallback(err) { function setNotificationEnableSlotCallback(err) {
if (err) { if (err) {
console.info("setNotificationEnableSlot failed " + JSON.stringify(err)); console.error(`setNotificationEnableSlot failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setNotificationEnableSlot success"); console.info("setNotificationEnableSlot success");
} }
...@@ -3277,7 +3277,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC ...@@ -3277,7 +3277,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC
// isNotificationSlotEnabled // isNotificationSlotEnabled
function getEnableSlotCallback(err, data) { function getEnableSlotCallback(err, data) {
if (err) { if (err) {
console.info("isNotificationSlotEnabled failed " + JSON.stringify(err)); console.error(`isNotificationSlotEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("isNotificationSlotEnabled success"); console.info("isNotificationSlotEnabled success");
} }
...@@ -3371,7 +3371,7 @@ let enable = true; ...@@ -3371,7 +3371,7 @@ let enable = true;
function callback(err) { function callback(err) {
if (err) { if (err) {
console.info("setSyncNotificationEnabledWithoutApp failed " + JSON.stringify(err)); console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.info("setSyncNotificationEnabledWithoutApp success"); console.info("setSyncNotificationEnabledWithoutApp success");
} }
...@@ -3424,7 +3424,7 @@ let enable = true; ...@@ -3424,7 +3424,7 @@ let enable = true;
notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => { notificationManager.setSyncNotificationEnabledWithoutApp(userId, enable).then(() => {
console.info('setSyncNotificationEnabledWithoutApp success'); console.info('setSyncNotificationEnabledWithoutApp success');
}).catch((err) => { }).catch((err) => {
console.info('setSyncNotificationEnabledWithoutApp, err:' + JSON.stringify(err)); console.error(`setSyncNotificationEnabledWithoutApp failed, code is ${err.code}, message is ${err.message}`);
}); });
``` ```
......
...@@ -84,13 +84,13 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void ...@@ -84,13 +84,13 @@ activateOsAccount(localId: number, callback: AsyncCallback&lt;void&gt;): void
try { try {
accountManager.activateOsAccount(localId, (err)=>{ accountManager.activateOsAccount(localId, (err)=>{
if (err) { if (err) {
console.log("activateOsAccount failed, error:" + JSON.stringify(err)); console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.log("activateOsAccount successfully"); console.log("activateOsAccount successfully");
} }
}); });
} catch (err) { } catch (err) {
console.log("activateOsAccount exception:" + JSON.stringify(err)); console.error(`activateOsAccount failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -170,13 +170,13 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void ...@@ -170,13 +170,13 @@ checkMultiOsAccountEnabled(callback: AsyncCallback&lt;boolean&gt;): void
try { try {
accountManager.checkMultiOsAccountEnabled((err, isEnabled) => { accountManager.checkMultiOsAccountEnabled((err, isEnabled) => {
if (err) { if (err) {
console.log("checkMultiOsAccountEnabled failed, error: " + JSON.stringify(err)); console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
} else { } else {
console.log("checkMultiOsAccountEnabled successfully, isEnabled: " + isEnabled); console.log("checkMultiOsAccountEnabled successfully, isEnabled: " + isEnabled);
} }
}); });
} catch (err) { } catch (err) {
console.log("checkMultiOsAccountEnabled exception: " + JSON.stringify(err)); console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
...@@ -208,10 +208,10 @@ checkMultiOsAccountEnabled(): Promise&lt;boolean&gt; ...@@ -208,10 +208,10 @@ checkMultiOsAccountEnabled(): Promise&lt;boolean&gt;
accountManager.checkMultiOsAccountEnabled().then((isEnabled) => { accountManager.checkMultiOsAccountEnabled().then((isEnabled) => {
console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled); console.log('checkMultiOsAccountEnabled successfully, isEnabled: ' + isEnabled);
}).catch((err) => { }).catch((err) => {
console.log('checkMultiOsAccountEnabled failed, error: ' + JSON.stringify(err)); console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
}); });
} catch (err) { } catch (err) {
console.log('checkMultiOsAccountEnabled exception: ' + JSON.stringify(err)); console.error(`checkMultiOsAccountEnabled failed, code is ${err.code}, message is ${err.message}`);
} }
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册