diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 73d21161ce9aa37f7242b49f615759e547c1925a..3cb32c4a2cdcbf7dbe451e3a8e880bc3414cc689 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -79,7 +79,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -135,7 +135,7 @@ try { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -177,7 +177,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -217,7 +217,7 @@ try { console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -262,7 +262,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -310,7 +310,7 @@ try { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 3304f535b5fd5fe52562e237a9f48c60cd794067..eb92543feba85b2ce4abe3cb0f213fd19dccffe4 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -306,7 +306,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal missionManager.getMissionInfo('', testMissionId, (error, mission) => { if (error) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); @@ -392,7 +392,7 @@ Obtains information about all missions. This API uses an asynchronous callback t try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('size = ${missions.length}'); console.log('missions = ${JSON.stringify(missions)}'); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md index b57435673e0d2372d4980c5a540fea618719c839..d50bb380f662b1c992b10ef8f8b2b8ff7088d061 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index b85364df96d39f3b8bd66f64910f3e15e5867ca7..fbf50f68387385c7d69c02ce599285a5b8ad2310 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -375,10 +375,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error console.log('Caller call() called'); }) .catch((callErr) => { - console.log('Caller.call catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.call catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -456,10 +456,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error data.readParcelable(retmsg); }) .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.callWithResult catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -498,10 +498,10 @@ Releases the caller interface of the target ability. try { caller.release(); } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ${JSON.stringify(releaseErr.code)}, error.message: ${JSON.stringify(releaseErr.message)}'); + console.log('Caller.release catch error, error.code: ${releaseErr.code}, error.message: ${releaseErr.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -538,10 +538,10 @@ Registers a callback that is invoked when the stub on the target ability is disc console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.onRelease catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.onRelease catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -587,10 +587,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -637,10 +637,10 @@ For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). caller.on('release', onReleaseCallBack); caller.off('release', onReleaseCallBack); } catch (error) { - console.log('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -686,10 +686,10 @@ For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). caller.on('release', onReleaseCallBack); caller.off('release'); } catch (error) { - console.error('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.error('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.error('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -759,7 +759,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -798,7 +798,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error try { this.callee.off(method); } catch (error) { - console.log('Callee.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index c7fd0b0f4a3f21eec8dbf66c51f890d6436b08f0..89c8919f494252120fff49a42cc8335c29ec702b 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -186,10 +186,10 @@ try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { wantAgent = data; }).catch((err) => { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); }); } catch (err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -280,7 +280,7 @@ function getWantAgentCallback(err, data) { // getBundleName callback function getBundleNameCallback(err, data) { if(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } else { console.info('getBundleName ok! ${JSON.stringify(data)}'); } @@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getBundleName(wantAgent, getBundleNameCallback); } catch(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -391,16 +391,16 @@ function getWantAgentCallback(err, data) { WantAgent.getBundleName(wantAgent).then((data)=>{ console.info('getBundleName ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) { // getUid callback function getUidCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getUid(wantAgent, getUidCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -603,16 +603,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -704,7 +704,7 @@ function getWantAgentCallback(err, data) { // getWant callback function getWantCallback(err, data) { if(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } else { console.info('getWant ok! ${JSON.stringify(data)}'); } @@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getWant(wantAgent, getWantCallback); } catch(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -817,16 +817,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -917,7 +917,7 @@ function getWantAgentCallback(err, data) { // cancel callback function cancelCallback(err, data) { if(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } else { console.info('cancel ok!'); } @@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.cancel(wantAgent, cancelCallback); } catch(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1028,16 +1028,16 @@ function getWantAgentCallback(err, data) { WantAgent.cancel(wantAgent).then((data)=>{ console.info('cancel ok!'); }).catch((err)=>{ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1131,7 +1131,7 @@ function getWantAgentCallback(err, data) { // trigger callback function triggerCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1239,7 +1239,7 @@ function getWantAgentCallback(err, data) { // equal callback function equalCallback(err, data) { if(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } else { console.info('equal ok! ${JSON.stringify(data)}'); } @@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.equal(wantAgent1,wantAgent2,equalCallback); } catch(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1353,16 +1353,16 @@ function getWantAgentCallback(err, data) { WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ console.info('equal ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); }) } catch(err){ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1451,7 +1451,7 @@ function getWantAgentCallback(err, data) { // getOperationTypeCallback callback function getOperationTypeCallback(err, data) { if(err) { - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } else { console.info('getOperationType ok! ${JSON.stringify(data)}'); } @@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); } catch(err) { - console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1560,16 +1560,16 @@ function getWantAgentCallback(err, data) { WantAgent.getOperationType(wantAgent).then((data)=>{ console.info('getOperationType ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-application-missionManager.md b/en/application-dev/reference/apis/js-apis-application-missionManager.md index 97ea9181621dbc9b95d355762cb839af903771cc..9cc1ecce166669fa3962ba8a32007f81c43a7af8 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-application-missionManager.md @@ -170,7 +170,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { if (error.code) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -247,7 +247,7 @@ Obtains information about all missions. This API uses an asynchronous callback t missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -319,7 +319,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -328,7 +328,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback missionManager.getMissionSnapShot('', id, (error, snapshot) => { if (error.code) { - console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionSnapShot failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('bundleName = ${snapshot.ability.bundleName}'); @@ -408,7 +408,7 @@ Locks a given mission. This API uses an asynchronous callback to return the resu missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -492,7 +492,7 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -580,7 +580,7 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -716,7 +716,7 @@ Switches a given mission to the foreground. This API uses an asynchronous callba missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -757,7 +757,7 @@ Switches a given mission to the foreground, with the startup parameters for the missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md index 23328be8945eb8c1aa55ba993077ff64f99b8fcc..ca06c2e4c8fb37d3a3c2d8987a13c5cb716aa327 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -20,7 +20,7 @@ import appManager from '@ohos.app.ability.appManager'; function getForegroundAppInfos() { appManager.getForegroundApplications((error, data) => { if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } for (let i = 0; i < data.length; i++) { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-context.md b/en/application-dev/reference/apis/js-apis-inner-application-context.md index 4b0dc98ea7bb95c66ebfe29cf938d376419a46f0..25e82e90dbf0137f11cdb092497b967515ad8166 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-context.md @@ -62,7 +62,7 @@ let bundleContext; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { - console.error('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -101,7 +101,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -141,7 +141,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -166,6 +166,6 @@ let applicationContext; try { applicationContext = this.context.getApplicationContext(); } catch (error) { - console.error('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 1ada23c202d88e7afa85da2a021130be1a434bc0..10b65b8ce5a815a9d4f4355bbf3f6abbc17d3dd9 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -38,7 +38,7 @@ Called when the mission continuation is complete. distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 5c3200aedcf788ea30bba84156fd623ae7a2138f..ce50489a861c8ef4d519266bbaa50500ada2d18e 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -33,7 +33,7 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 3d3e1d3190082c757a442371fa671576cc5a6758..43771f06405de4d48c6b3831a5bf853b12bd9bca 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -30,6 +30,6 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 17441d6bb281e87f0ae45c8a4764f657809b7bee..4480583a2c123786c71d75356c7773bbcb08d75a 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -33,7 +33,7 @@ let upperLimit = 1; function getExtensionInfos() { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { if (error && error.code) { - console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index d7cfc2a25b572c3178c3da71d9e04c5fb9c3a8af..43d1896b408f7296781a4e5b8b96b3748b44b8b1 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -25,7 +25,7 @@ try { missionManager.getMissionInfo('', 1, (error, data) => { if (error.code) { // Process service logic errors. - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index cafe6d2675bfd9fe1deae8d548f4d07dc78f2e9b..744c2d363f20b94ee8a839062416e805f5e12734 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -27,7 +27,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -36,7 +36,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** missionManager.getMissionSnapShot('', id, (err, snapshot) => { if (err.code) { - console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}'); + console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index d19bd5fab148a6795b844d79159274e2c73f1c6c..f84648998cc5d6201a7d8af6e0021896651063b7 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -79,7 +79,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -87,7 +87,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -158,11 +158,11 @@ Starts an ability. This API uses a promise to return the result. }) .catch((error) => { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -225,7 +225,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, options, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -233,7 +233,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -300,7 +300,7 @@ Observe the following when using this API: this.context.startAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -308,7 +308,7 @@ Observe the following when using this API: }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -379,7 +379,7 @@ Observe the following when using this API: this.context.startAbilityWithAccount(want, accountId, options, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -387,7 +387,7 @@ Observe the following when using this API: }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -468,11 +468,11 @@ Observe the following when using this API: }) .catch((error) => { // Process service logic errors. - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -523,7 +523,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to this.context.startServiceExtensionAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -531,7 +531,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -591,11 +591,11 @@ Starts a new ServiceExtensionAbility. This API uses a promise to return the resu }) .catch((error) => { // Process service logic errors. - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -652,7 +652,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -660,7 +660,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -725,11 +725,11 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use }) .catch((error) => { // Process service logic errors. - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -777,7 +777,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch this.context.stopServiceExtensionAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -785,7 +785,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -842,11 +842,11 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise }) .catch((error) => { // Process service logic errors. - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -899,7 +899,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -907,7 +907,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -969,11 +969,11 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec }) .catch((error) => { // Process service logic errors. - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1010,7 +1010,7 @@ Terminates this ability. This API uses an asynchronous callback to return the re this.context.terminateSelf((error) => { if (error.code) { // Process service logic errors. - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -1053,7 +1053,7 @@ Terminates this ability. This API uses a promise to return the result. console.log('terminateSelf succeed'); }).catch((error) => { // Process service logic errors. - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); }); ``` @@ -1113,7 +1113,7 @@ Connects this ability to a ServiceExtensionAbility. connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1177,7 +1177,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1220,7 +1220,7 @@ Disconnects this ability from a ServiceExtensionAbility and after the successful commRemote = null; if (error.code) { // Process service logic errors. - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -1229,7 +1229,7 @@ Disconnects this ability from a ServiceExtensionAbility and after the successful } catch (paramError) { commRemote = null; // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1282,12 +1282,12 @@ Disconnects this ability from a ServiceExtensionAbility and after the successful .catch((error) => { commRemote = null; // Process service logic errors. - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { commRemote = null; // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1356,11 +1356,11 @@ Observe the following when using this API: console.log('startAbilityByCall succeed'); }).catch((error) => { // Process service logic errors. - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1388,10 +1388,10 @@ Observe the following when using this API: console.log('startAbilityByCall succeed'); }).catch((error) => { // Process service logic errors. - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md index b4818183f77657d3852de06570e199086dc70941..c2dd40beaed0071db3277e86e86aacfb032f98b5 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -58,7 +58,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, options, (error) => { if (error.code) { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -66,7 +66,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -110,10 +110,10 @@ Starts an ability. This API uses a promise to return the result. }) .catch((error) => { // Process service logic errors. - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inputdevice.md b/en/application-dev/reference/apis/js-apis-inputdevice.md index c131d9bbd3e50790624d4eca0ea41c94d7022dd2..c0d5352efa43ffe6e98a4bd911a5e89d4beba3ca 100644 --- a/en/application-dev/reference/apis/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis/js-apis-inputdevice.md @@ -31,7 +31,7 @@ try { inputDevice.getDeviceIds((error, ids) => { if (error) { console.log(`Failed to get device list. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } this.data = ids; @@ -91,7 +91,7 @@ try { inputDevice.getDeviceInfo(1, (error, inputDevice) => { if (error) { console.log(`Failed to get device information. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } console.log("The device name is: " + inputDevice.name); @@ -421,7 +421,7 @@ try { inputDevice.getKeyboardType(1, (error, number) => { if (error) { console.log(`Failed to get keyboardtype. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } console.log("The keyboard type of the device is: " + number); diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md index 6ebe3fe1b7988aab988b1b93cdf1664378665304..8e6be70a746f74f91a5b4f1fb5778c37f80428ed 100644 --- a/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md +++ b/en/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md @@ -216,8 +216,8 @@ Code before the change: try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } @@ -260,8 +260,8 @@ Code after the change: try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } diff --git a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md index 869ff66b05c240d76e5382b493942c712e04579a..a060017598caf758524179f7fa4ee836ee5f6fec 100644 --- a/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md +++ b/en/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md @@ -71,7 +71,7 @@ function getWantAgentCallback(err, data) { // getUid callback function triggerCallback(err, data) { if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } else { console.info('getUid ok!' + JSON.stringify(data)); } @@ -79,12 +79,12 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } } try{ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err){ - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getWantAgent failed!' + err.code + err.message); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index a55df44d265784d78e092607c61e1a01a048f565..5217f9096de80f2e3a3d13669864adc5d663176e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -79,7 +79,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -135,7 +135,7 @@ try { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -177,7 +177,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -217,7 +217,7 @@ try { console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -262,7 +262,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -310,7 +310,7 @@ try { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 13170311701300302241b40d1e4f934e8feb6b20..566ae59852950a9c918485661e57fee21474faae 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -306,7 +306,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M missionManager.getMissionInfo('', testMissionId, (error, mission) => { if (error) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); @@ -392,7 +392,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('size = ${missions.length}'); console.log('missions = ${JSON.stringify(missions)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md index ca1f60b2d08a6d425c0ac15af6ebdcf31c464efe..c02ff5f4cdae2883cc6dcc85d5c252b26a0c1f08 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index 8b83fbb08dc2883a58a4d760449f913d1198efad..ba0ebcb790cc4a877625f37d44526f18f32f8cac 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -402,10 +402,10 @@ call(method: string, data: rpc.Parcelable): Promise<void>; console.log('Caller call() called'); }) .catch((callErr) => { - console.log('Caller.call catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.call catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -483,10 +483,10 @@ callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequ data.readParcelable(retmsg); }) .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.callWithResult catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -525,10 +525,10 @@ release(): void; try { caller.release(); } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ${JSON.stringify(releaseErr.code)}, error.message: ${JSON.stringify(releaseErr.message)}'); + console.log('Caller.release catch error, error.code: ${releaseErr.code}, error.message: ${releaseErr.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -565,10 +565,10 @@ release(): void; console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.onRelease catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.onRelease catch error, error.code: $error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -614,10 +614,10 @@ release(): void; console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -664,10 +664,10 @@ off(type: 'release', callback: OnReleaseCallback): void; caller.on('release', onReleaseCallBack); caller.off('release', onReleaseCallBack); } catch (error) { - console.log('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -713,10 +713,10 @@ off(type: 'release'): void; caller.on('release', onReleaseCallBack); caller.off('release'); } catch (error) { - console.error('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.error('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.error('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -786,7 +786,7 @@ on(method: string, callback: CalleeCallback): void; try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -825,7 +825,7 @@ off(method: string): void; try { this.callee.off(method); } catch (error) { - console.log('Callee.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index 1091421a39f7461e182a2ad5f5b149670d14abb7..540592747ed6c478f156cfb3fe9aea85e2bebb6b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -186,10 +186,10 @@ try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { wantAgent = data; }).catch((err) => { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); }); } catch (err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -280,7 +280,7 @@ function getWantAgentCallback(err, data) { //getBundleName回调 function getBundleNameCallback(err, data) { if(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } else { console.info('getBundleName ok! ${JSON.stringify(data)}'); } @@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getBundleName(wantAgent, getBundleNameCallback); } catch(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -391,16 +391,16 @@ function getWantAgentCallback(err, data) { WantAgent.getBundleName(wantAgent).then((data)=>{ console.info('getBundleName ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) { //getUid回调 function getUidCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getUid(wantAgent, getUidCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -603,16 +603,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -704,7 +704,7 @@ function getWantAgentCallback(err, data) { //getWant回调 function getWantCallback(err, data) { if(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } else { console.info('getWant ok! ${JSON.stringify(data)}'); } @@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getWant(wantAgent, getWantCallback); } catch(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -817,16 +817,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}}'); } ``` @@ -917,7 +917,7 @@ function getWantAgentCallback(err, data) { //cancel回调 function cancelCallback(err, data) { if(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } else { console.info('cancel ok!'); } @@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.cancel(wantAgent, cancelCallback); } catch(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1028,16 +1028,16 @@ function getWantAgentCallback(err, data) { WantAgent.cancel(wantAgent).then((data)=>{ console.info('cancel ok!'); }).catch((err)=>{ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1131,7 +1131,7 @@ function getWantAgentCallback(err, data) { //trigger回调 function triggerCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1239,7 +1239,7 @@ function getWantAgentCallback(err, data) { //equal回调 function equalCallback(err, data) { if(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } else { console.info('equal ok! ${JSON.stringify(data)}'); } @@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.equal(wantAgent1,wantAgent2,equalCallback); } catch(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1353,16 +1353,16 @@ function getWantAgentCallback(err, data) { WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ console.info('equal ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); }) } catch(err){ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1451,7 +1451,7 @@ function getWantAgentCallback(err, data) { //getOperationTypeCallback回调 function getOperationTypeCallback(err, data) { if(err) { - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } else { console.info('getOperationType ok! ${JSON.stringify(data)}'); } @@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); } catch(err) { - console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1560,16 +1560,16 @@ function getWantAgentCallback(err, data) { WantAgent.getOperationType(wantAgent).then((data)=>{ console.info('getOperationType ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md index 6338badb4810ea184689de12d0278260db64c76f..bc25988f7a20c5d3693aa5f0b9949045965299be 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md @@ -170,7 +170,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { if (error.code) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -247,7 +247,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -319,7 +319,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -328,7 +328,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& missionManager.getMissionSnapShot('', id, (error, snapshot) => { if (error.code) { - console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionSnapShot failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('bundleName = ${snapshot.ability.bundleName}'); @@ -408,7 +408,7 @@ lockMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -492,7 +492,7 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -580,7 +580,7 @@ clearMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -716,7 +716,7 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -757,7 +757,7 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md index ca60f6ebdfae984ee378a10acbd0efff756731e5..5c8754dc11a5a7e2c7cb4dfe2bb381835113e465 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -20,7 +20,7 @@ import appManager from '@ohos.app.ability.appManager'; function getForegroundAppInfos() { appManager.getForegroundApplications((error, data) => { if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } for (let i = 0; i < data.length; i++) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md index 2c78be7ca1adbe8592335d2f25f27efab5b0329e..618cae585d94f5d1bbfbfd1204672925147bd38d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md @@ -62,7 +62,7 @@ let bundleContext; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { - console.error('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -101,7 +101,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -141,7 +141,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -166,7 +166,7 @@ let applicationContext; try { applicationContext = this.context.getApplicationContext(); } catch (error) { - console.error('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 63c005cac40f77ebbf57a1ceab9fba2ef75a907d..768e509c1ec52fbd1060017a06dd431f253b108a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -38,7 +38,7 @@ Mission迁移完成后调用,返回迁移结果。 distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 0a2b55830f4d7a3f6c5fe0d8fa3f1b1557aedd30..209d0a0567bf64818844ce7fac0057b31fa6de56 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -33,7 +33,7 @@ distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 54c4504afc1b44ba1cd7055715447ec6c8c2bd80..d18486f4fff03e6e5066159985929df272fb207d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -30,7 +30,7 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -69,6 +69,6 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 5dd3ccabac7f20b0c74aad2abf0cfa9a81f488c5..37e2743da7dd4cc4f1d2f8b63c4cf310edad4da1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -33,7 +33,7 @@ let upperLimit = 1; function getExtensionInfos() { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { if (error && error.code) { - console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index cab87eea78ef2427c8ae3c346f81552deff4a6a0..389f8af0a9dfe2e91a2adaa8b3e345c6491bfab6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -25,7 +25,7 @@ try { missionManager.getMissionInfo('', 1, (error, data) => { if (error.code) { // 处理业务逻辑错误 - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index cc8c511b378e4af108e98ce5051bd95d45e7c3c0..df07e847693276b618c1b13b6fa906f85782577b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -27,7 +27,7 @@ try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -36,7 +36,7 @@ missionManager.getMissionSnapShot('', id, (err, snapshot) => { if (err.code) { - console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}'); + console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 9b835fee85ba01b9ccfd41b2bc65ccca524763f1..9e8a8d1c933b74518fc3aa3b0b6ed4b77b9f956b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -79,7 +79,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; this.context.startAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -87,7 +87,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -158,11 +158,11 @@ startAbility(want: Want, options?: StartOptions): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -225,7 +225,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& this.context.startAbility(want, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -233,7 +233,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -300,7 +300,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< this.context.startAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -308,7 +308,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -379,7 +379,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca this.context.startAbilityWithAccount(want, accountId, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -387,7 +387,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -468,11 +468,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -523,7 +523,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; this.context.startServiceExtensionAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -531,7 +531,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -591,11 +591,11 @@ startServiceExtensionAbility(want: Want): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -652,7 +652,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -660,7 +660,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -725,11 +725,11 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ }) .catch((error) => { // 处理业务逻辑错误 - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -777,7 +777,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; this.context.stopServiceExtensionAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -785,7 +785,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -842,11 +842,11 @@ stopServiceExtensionAbility(want: Want): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -899,7 +899,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code, error.message: ${error.message}'); return; } // 执行正常业务 @@ -907,7 +907,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -969,11 +969,11 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< }) .catch((error) => { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1010,7 +1010,7 @@ terminateSelf(callback: AsyncCallback<void>): void; this.context.terminateSelf((error) => { if (error.code) { // 处理业务逻辑错误 - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -1053,7 +1053,7 @@ terminateSelf(): Promise<void>; console.log('terminateSelf succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); }); ``` @@ -1113,7 +1113,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1177,7 +1177,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1220,7 +1220,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< commRemote = null; if (error.code) { // 处理业务逻辑错误 - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -1229,7 +1229,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< } catch (paramError) { commRemote = null; // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1282,12 +1282,12 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>; .catch((error) => { commRemote = null; // 处理业务逻辑错误 - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { commRemote = null; // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1356,11 +1356,11 @@ startAbilityByCall(want: Want): Promise<Caller>; console.log('startAbilityByCall succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1388,10 +1388,10 @@ startAbilityByCall(want: Want): Promise<Caller>; console.log('startAbilityByCall succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md index 363fce781c87703a4b5de91ebd2b3e0d4398589e..70808c6cf9a511ae825b4ab8b878978cd4b094b8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -58,7 +58,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& this.context.startAbility(want, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -66,7 +66,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -110,10 +110,10 @@ startAbility(want: Want, options?: StartOptions): Promise\ }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md index 39968eb10919ed8bf08043a50f47d79bc248e9e6..403e1b512ee983a79d6a64f3e17c809b76adf99d 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md @@ -213,8 +213,8 @@ Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用R try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } @@ -257,8 +257,8 @@ Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用R try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ' + JSON.stringify(error.code) + - ' error.message: ' + JSON.stringify(error.message)); + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); } } } diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md index 468cdd16e5e625acc563890bea2ddf380245ba4e..cc403f2572f2c267f01450cf85126e183e1bce96 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md @@ -71,7 +71,7 @@ function getWantAgentCallback(err, data) { //getUid回调 function triggerCallback(err, data) { if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } else { console.info('getUid ok!' + JSON.stringify(data)); } @@ -79,12 +79,12 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } } try{ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err){ - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getWantAgent failed!' + err.code + err.message); } ```