未验证 提交 1ce4b431 编写于 作者: O openharmony_ci 提交者: Gitee

!14498 示例代码低错

Merge pull request !14498 from zengyawen/cherry-pick-1675948141
......@@ -92,6 +92,7 @@ hash(path: string, algorithm: string, callback: AsyncCallback<string>): vo
**示例:**
```js
let filePath = pathDir + "/test.txt";
Hash.hash(filePath, "sha256", (err, str) => {
if (err) {
console.info("calculate file hash failed with error message: " + err.message + ", error code: " + err.code);
......
......@@ -46,11 +46,11 @@ addCheckRule(rule: bigint): void
```js
try {
// 添加一条规则
hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);}
hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);
// 添加多条规则
hichecker.addCheckRule(
hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH);
catch (err) {
// hichecker.addCheckRule(
// hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH);
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
}
```
......@@ -76,9 +76,9 @@ try {
// 删除一条规则
hichecker.removeCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);
// 删除多条规则
hichecker.removeCheckRule(
hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH);
catch (err) {
// hichecker.removeCheckRule(
// hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH);
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
}
```
......@@ -113,7 +113,7 @@ try {
// 查询是否包含
hichecker.containsCheckRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // return true;
hichecker.containsCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // return false;
catch (err) {
} catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`);
}
```
......
......@@ -297,7 +297,7 @@ import hidebug from '@ohos.hidebug'
try {
hidebug.startJsCpuProfiling("cpu_profiling");
...
// ...
hidebug.stopJsCpuProfiling();
} catch (error) {
console.info(error.code)
......@@ -326,7 +326,7 @@ import hidebug from '@ohos.hidebug'
try {
hidebug.startJsCpuProfiling("cpu_profiling");
...
// ...
hidebug.stopJsCpuProfiling();
} catch (error) {
console.info(error.code)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册