From 28b25cbe24925640552c2ea5d7c3a4f58189f935 Mon Sep 17 00:00:00 2001 From: 189******51 Date: Tue, 29 Aug 2023 02:51:04 +0000 Subject: [PATCH] =?UTF-8?q?IssueNo:=20#I7WPSP:[=E6=96=B0=E9=9C=80=E6=B1=82?= =?UTF-8?q?]:=20Rectify=20the=20arkts=20syntax2=20Description:=20Rectify?= =?UTF-8?q?=20the=20arkts=20syntax2=20Sig:=20SIG=5FApplicaitonFramework=20?= =?UTF-8?q?Feature=20or=20Bugfix:=20Feature=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 189******51 --- .../reference/apis/js-apis-installer.md | 52 +++++++++++++------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/zh-cn/application-dev/reference/apis/js-apis-installer.md b/zh-cn/application-dev/reference/apis/js-apis-installer.md index 64dc39275f..6eb07d7b41 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-installer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md @@ -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); } ``` -- GitLab