未验证 提交 2598f82f 编写于 作者: O openharmony_ci 提交者: Gitee

!23312 Rectify the arkts syntax2

Merge pull request !23312 from 189******51/master
......@@ -76,7 +76,9 @@ try {
}
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -133,7 +135,9 @@ try {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -194,7 +198,9 @@ try {
}
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -258,7 +264,9 @@ try {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -313,7 +321,9 @@ try {
}
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -371,7 +381,9 @@ try {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -433,7 +445,9 @@ try {
}
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -498,6 +512,8 @@ try {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
});
} catch (err) {
console.log(`Operation failed: error code is ${err.code} and error message is ${err.message}`);
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
console.log(`Operation failed: error code is ${code} and error message is ${message}`);
}
```
......@@ -57,7 +57,8 @@ try {
}
});
} catch (error) {
console.error('getBundleInstaller failed:' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed:' + message);
}
```
......@@ -89,7 +90,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -112,12 +114,14 @@ getBundleInstallerSync(): BundleInstaller;
```ts
import installer from '@ohos.bundle.installer';
import { BusinessError } from '@ohos.base';
try {
installer.getBundleInstallerSync();
console.info('getBundleInstallerSync successfully.');
} catch (error) {
console.error('getBundleInstallerSync failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstallerSync failed. Cause: ' + message);
}
```
......@@ -200,7 +204,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
## BundleInstaller.install
......@@ -275,7 +280,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -363,7 +369,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -425,7 +432,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -480,7 +488,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
## BundleInstaller.uninstall
......@@ -544,7 +553,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -603,7 +613,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -656,7 +667,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -718,7 +730,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -774,7 +787,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -835,7 +849,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -910,7 +925,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -978,7 +994,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......@@ -1051,7 +1068,8 @@ try {
console.error('getBundleInstaller failed. Cause: ' + error.message);
});
} catch (error) {
console.error('getBundleInstaller failed. Cause: ' + error.message);
let message = (error as BusinessError).message;
console.error('getBundleInstaller failed. Cause: ' + message);
}
```
......
......@@ -63,7 +63,9 @@ try {
}
})
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
......@@ -115,7 +117,9 @@ try {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
})
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
......@@ -157,12 +161,15 @@ getLauncherAbilityInfoSync(bundleName: string, userId: number) : Array\<[Launche
```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try {
let data = launcherBundleManager.getLauncherAbilityInfoSync("com.example.demo", 100);
console.log("data is " + JSON.stringify(data));
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
......@@ -214,7 +221,9 @@ try {
}
});
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
## launcherBundlemanager.getAllLauncherAbilityInfo<sup>9+</sup>
......@@ -263,7 +272,9 @@ try {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
});
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
......@@ -313,7 +324,9 @@ try {
}
});
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
......@@ -361,7 +374,9 @@ try {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
});
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
......@@ -399,11 +414,14 @@ getShortcutInfoSync(bundleName : string) : Array\<[ShortcutInfo](js-apis-bundleM
```ts
import launcherBundleManager from '@ohos.bundle.launcherBundleManager';
import { BusinessError } from '@ohos.base';
try {
let data = launcherBundleManager.getShortcutInfoSync("com.example.demo");
console.log("data is " + JSON.stringify(data));
} catch (errData) {
console.error(`errData is errCode:${errData.code} message:${errData.message}`);
let code = (errData as BusinessError).code;
let message = (errData as BusinessError).message;
console.error(`errData is errCode:${code} message:${message}`);
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册