1e41f4b71Sopenharmony_ci# @ohos.systemParameterEnhance (System Parameter) (System API) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe **SystemParameter** module provides system services with easy access to key-value pairs. You can use the APIs provided by this module to describe the service status and change the service behavior. The basic operation primitives are get and set. You can obtain the values of system parameters through getters and modify the values through setters. 4e41f4b71Sopenharmony_ciFor details about the system parameter design principles and definitions, see [Parameter Management](../../../device-dev/subsystems/subsys-boot-init-sysparam.md). 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci> **NOTE** 7e41f4b71Sopenharmony_ci> 8e41f4b71Sopenharmony_ci> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 9e41f4b71Sopenharmony_ci> - The APIs provided by this module are system APIs. 10e41f4b71Sopenharmony_ci> - Third-party applications cannot use the APIs provided by this module, because system parameters each require specific discretionary access control (DAC) and mandatory access control (MAC) permissions. 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## Modules to Import 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci```ts 15e41f4b71Sopenharmony_ciimport { systemParameterEnhance } from '@kit.BasicServicesKit'; 16e41f4b71Sopenharmony_ci``` 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci## systemParameterEnhance.getSync 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_cigetSync(key: string, def?: string): string 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ciObtains the value of the system parameter with the specified key. 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci**Parameters** 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 29e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 30e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 31e41f4b71Sopenharmony_ci| def | string | No| Default value of the system parameter.<br> It works only when the system parameter does not exist.<br> The value can be **undefined** or any custom value.| 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**Return value** 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci| Type| Description| 36e41f4b71Sopenharmony_ci| -------- | -------- | 37e41f4b71Sopenharmony_ci| string | Value of the system parameter.<br> If the specified key exists, the set value is returned.<br> If the specified key does not exist and **def** is set to a valid value, the set value is returned. If the specified key does not exist and **def** is set to an invalid value (such as **undefined**) or is not set, an exception is thrown.| 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci**Error codes** 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci| ID| Error Message | 42e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 43e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 44e41f4b71Sopenharmony_ci| 14700101 | System parameter not found. | 45e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 46e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci**Example** 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci```ts 53e41f4b71Sopenharmony_citry { 54e41f4b71Sopenharmony_ci let info: string = systemParameterEnhance.getSync("const.ohos.apiversion"); 55e41f4b71Sopenharmony_ci console.log(JSON.stringify(info)); 56e41f4b71Sopenharmony_ci} catch(e) { 57e41f4b71Sopenharmony_ci console.log("getSync unexpected error: " + e); 58e41f4b71Sopenharmony_ci} 59e41f4b71Sopenharmony_ci``` 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci## systemParameterEnhance.get 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ciget(key: string, callback: AsyncCallback<string>): void 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ciObtains the value of the system parameter with the specified key. 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci**Parameters** 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 72e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 73e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 74e41f4b71Sopenharmony_ci| callback | AsyncCallback<string> | Yes| Callback used to return the result.| 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci**Error codes** 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci| ID| Error Message | 79e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 80e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 81e41f4b71Sopenharmony_ci| 14700101 | System parameter not found. | 82e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 83e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ci**Example** 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci```ts 90e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_citry { 93e41f4b71Sopenharmony_ci systemParameterEnhance.get("const.ohos.apiversion", (err: BusinessError, data: string) => { 94e41f4b71Sopenharmony_ci if (err == undefined) { 95e41f4b71Sopenharmony_ci console.log("get test.parameter.key value success:" + data) 96e41f4b71Sopenharmony_ci } else { 97e41f4b71Sopenharmony_ci console.log(" get test.parameter.key value err:" + err.code) 98e41f4b71Sopenharmony_ci }}); 99e41f4b71Sopenharmony_ci} catch(e) { 100e41f4b71Sopenharmony_ci console.log("get unexpected error: " + e); 101e41f4b71Sopenharmony_ci} 102e41f4b71Sopenharmony_ci``` 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ci## systemParameterEnhance.get 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ciget(key: string, def: string, callback: AsyncCallback<string>): void 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ciObtains the value of the system parameter with the specified key. This API uses an asynchronous callback to return the result. 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci**Parameters** 113e41f4b71Sopenharmony_ci 114e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 115e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 116e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 117e41f4b71Sopenharmony_ci| def | string | Yes| Default value.| 118e41f4b71Sopenharmony_ci| callback | AsyncCallback<string> | Yes| Callback used to return the result.| 119e41f4b71Sopenharmony_ci 120e41f4b71Sopenharmony_ci**Error codes** 121e41f4b71Sopenharmony_ci 122e41f4b71Sopenharmony_ci| ID| Error Message | 123e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 124e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 125e41f4b71Sopenharmony_ci| 14700101 | System parameter not found. | 126e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 127e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci**Example** 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci```ts 134e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_citry { 137e41f4b71Sopenharmony_ci systemParameterEnhance.get("const.ohos.apiversion", "default", (err: BusinessError, data: string) => { 138e41f4b71Sopenharmony_ci if (err == undefined) { 139e41f4b71Sopenharmony_ci console.log("get test.parameter.key value success:" + data) 140e41f4b71Sopenharmony_ci } else { 141e41f4b71Sopenharmony_ci console.log(" get test.parameter.key value err:" + err.code) 142e41f4b71Sopenharmony_ci } 143e41f4b71Sopenharmony_ci }); 144e41f4b71Sopenharmony_ci} catch(e) { 145e41f4b71Sopenharmony_ci console.log("get unexpected error:" + e) 146e41f4b71Sopenharmony_ci} 147e41f4b71Sopenharmony_ci``` 148e41f4b71Sopenharmony_ci 149e41f4b71Sopenharmony_ci## systemParameterEnhance.get 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ciget(key: string, def?: string): Promise<string> 152e41f4b71Sopenharmony_ci 153e41f4b71Sopenharmony_ciObtains the value of the system parameter with the specified key. This API uses a promise to return the result. 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 156e41f4b71Sopenharmony_ci 157e41f4b71Sopenharmony_ci**Parameters** 158e41f4b71Sopenharmony_ci 159e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 160e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 161e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 162e41f4b71Sopenharmony_ci| def | string | No| Default value of the system parameter.<br> It works only when the system parameter does not exist.<br> The value can be **undefined** or any custom value.| 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci**Return value** 165e41f4b71Sopenharmony_ci 166e41f4b71Sopenharmony_ci| Type| Description| 167e41f4b71Sopenharmony_ci| -------- | -------- | 168e41f4b71Sopenharmony_ci| Promise<string> | Promise used to return the execution result.| 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ci**Error codes** 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci| ID| Error Message | 173e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 174e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 175e41f4b71Sopenharmony_ci| 14700101 | System parameter not found. | 176e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 177e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci**Example** 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ci```ts 184e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 185e41f4b71Sopenharmony_ci 186e41f4b71Sopenharmony_citry { 187e41f4b71Sopenharmony_ci let p: Promise<string> = systemParameterEnhance.get("const.ohos.apiversion"); 188e41f4b71Sopenharmony_ci p.then((value: string) => { 189e41f4b71Sopenharmony_ci console.log("get test.parameter.key success: " + value); 190e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 191e41f4b71Sopenharmony_ci console.log("get test.parameter.key error: " + err.code); 192e41f4b71Sopenharmony_ci }); 193e41f4b71Sopenharmony_ci} catch(e) { 194e41f4b71Sopenharmony_ci console.log("get unexpected error: " + e); 195e41f4b71Sopenharmony_ci} 196e41f4b71Sopenharmony_ci``` 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ci## systemParameterEnhance.setSync 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_cisetSync(key: string, value: string): void 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_ciSets a value for the system parameter with the specified key. 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ci**Parameters** 207e41f4b71Sopenharmony_ci 208e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 209e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 210e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 211e41f4b71Sopenharmony_ci| value | string | Yes| Value of the system parameter to set. The value can contain a maximum of 96 bytes (including the end character).| 212e41f4b71Sopenharmony_ci 213e41f4b71Sopenharmony_ci**Error codes** 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ci| ID| Error Message | 216e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 217e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 218e41f4b71Sopenharmony_ci| 14700102 | Invalid system parameter value. | 219e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 220e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 221e41f4b71Sopenharmony_ci 222e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_ci**Example** 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ci```ts 227e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 228e41f4b71Sopenharmony_ci 229e41f4b71Sopenharmony_citry { 230e41f4b71Sopenharmony_ci systemParameterEnhance.setSync("test.parameter.key", "default"); 231e41f4b71Sopenharmony_ci} catch(e) { 232e41f4b71Sopenharmony_ci console.log("set unexpected error: " + e); 233e41f4b71Sopenharmony_ci} 234e41f4b71Sopenharmony_ci``` 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ci## systemParameterEnhance.set 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ciset(key: string, value: string, callback: AsyncCallback<void>): void 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ciSets a value for the system parameter with the specified key. This API uses an asynchronous callback to return the result. 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ci**Parameters** 245e41f4b71Sopenharmony_ci 246e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 247e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 248e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 249e41f4b71Sopenharmony_ci| value | string | Yes| Value of the system parameter to set. The value can contain a maximum of 96 bytes (including the end character).| 250e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes| Callback used to return the result.| 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ci**Error codes** 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci| ID| Error Message | 255e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 256e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 257e41f4b71Sopenharmony_ci| 14700102 | Invalid system parameter value. | 258e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 259e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 260e41f4b71Sopenharmony_ci 261e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 262e41f4b71Sopenharmony_ci 263e41f4b71Sopenharmony_ci**Example** 264e41f4b71Sopenharmony_ci 265e41f4b71Sopenharmony_ci```ts 266e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 267e41f4b71Sopenharmony_ci 268e41f4b71Sopenharmony_citry { 269e41f4b71Sopenharmony_ci systemParameterEnhance.set("test.parameter.key", "testValue", (err: BusinessError, data: void) => { 270e41f4b71Sopenharmony_ci if (err == undefined) { 271e41f4b71Sopenharmony_ci console.log("set test.parameter.key value success :" + data) 272e41f4b71Sopenharmony_ci } else { 273e41f4b71Sopenharmony_ci console.log("set test.parameter.key value err:" + err.code) 274e41f4b71Sopenharmony_ci }}); 275e41f4b71Sopenharmony_ci} catch(e) { 276e41f4b71Sopenharmony_ci console.log("set unexpected error: " + e); 277e41f4b71Sopenharmony_ci} 278e41f4b71Sopenharmony_ci``` 279e41f4b71Sopenharmony_ci 280e41f4b71Sopenharmony_ci## systemParameterEnhance.set 281e41f4b71Sopenharmony_ci 282e41f4b71Sopenharmony_ciset(key: string, value: string): Promise<void> 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ciSets a value for the system parameter with the specified key. This API uses a promise to return the result. 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ci**Parameters** 289e41f4b71Sopenharmony_ci 290e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description| 291e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | 292e41f4b71Sopenharmony_ci| key | string | Yes| Key of the system parameter. The value can contain a maximum of 128 bytes. Only letters, digits, periods (.), hyphens (-), at signs (@), colons (:), and underscores (_) are allowed.| 293e41f4b71Sopenharmony_ci| value| string | Yes| Value of the system parameter to set. The value can contain a maximum of 96 bytes (including the end character).| 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci**Return value** 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ci| Type| Description| 298e41f4b71Sopenharmony_ci| -------- | -------- | 299e41f4b71Sopenharmony_ci| Promise<void> | Promise used to return the execution result.| 300e41f4b71Sopenharmony_ci 301e41f4b71Sopenharmony_ci**Error codes** 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_ci| ID| Error Message | 304e41f4b71Sopenharmony_ci| -------- | ------------------------------------------------------------ | 305e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.incorrect parameter types; 3.parameter verification failed. | 306e41f4b71Sopenharmony_ci| 14700102 | Invalid system parameter value. | 307e41f4b71Sopenharmony_ci| 14700103 | The operation on the system permission is denied. | 308e41f4b71Sopenharmony_ci| 14700104 | System internal error such as out memory or deadlock. | 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ciFor details about the error codes, see [System Parameter Error Codes](errorcode-system-parameterV9.md). 311e41f4b71Sopenharmony_ci 312e41f4b71Sopenharmony_ci**Example** 313e41f4b71Sopenharmony_ci 314e41f4b71Sopenharmony_ci```ts 315e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 316e41f4b71Sopenharmony_ci 317e41f4b71Sopenharmony_citry { 318e41f4b71Sopenharmony_ci let p: Promise<void> = systemParameterEnhance.set("test.parameter.key", "testValue"); 319e41f4b71Sopenharmony_ci p.then((value: void) => { 320e41f4b71Sopenharmony_ci console.log("set test.parameter.key success: " + value); 321e41f4b71Sopenharmony_ci }).catch((err: BusinessError) => { 322e41f4b71Sopenharmony_ci console.log(" set test.parameter.key error: " + err.code); 323e41f4b71Sopenharmony_ci }); 324e41f4b71Sopenharmony_ci} catch(e) { 325e41f4b71Sopenharmony_ci console.log("set unexpected error: " + e); 326e41f4b71Sopenharmony_ci} 327e41f4b71Sopenharmony_ci``` 328