!316 网络异常时异常捕捉

Merge pull request !316 from 何钱贝/master
This commit is contained in:
openharmony_ci 2024-10-30 15:34:01 +00:00 committed by Gitee
commit 32b7549114
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 31 additions and 24 deletions

View File

@ -2,8 +2,8 @@
"app": {
"bundleName": "com.ohos.dlpmanager",
"vendor": "example",
"versionCode": 1000117,
"versionName": "1.0.1.17",
"versionCode": 1000118,
"versionName": "1.0.1.18",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 12,

View File

@ -16,8 +16,8 @@
"app": {
"bundleName": "com.ohos.dlpmanager",
"vendor": "example",
"versionCode": 1000117,
"versionName": "1.0.1.17",
"versionCode": 1000118,
"versionName": "1.0.1.18",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 12,

View File

@ -148,27 +148,34 @@ struct encryptedSharing {
this.isConfirmButtonEnabled = true;
this.showToast($r('app.string.Share_File_Encrypted_Failed'));
}
let commandGetAccountInfoCallBack = JSON.parse(this.commandGetAccountInfo) as Record<string, object>;
HiLog.info(TAG, `commandGetAccountInfo Call Back errorCode: ${commandGetAccountInfoCallBack.errorCode}`);
let res = commandGetAccountInfoCallBack.result as Record<string, string>;
if (Number(commandGetAccountInfoCallBack.errorCode) === Constants.ERR_CODE_SUCCESS && res?.uid) {
this.ownerAccount = res?.uid;
this.ownerAccountID = res?.uid;
this.connectService.connectServiceShareAbility(Constants.COMMAND_SEARCH_USER_INFO);
} else {
this.enabledFocus = true;
this.isConfirmButtonEnabled = true;
this.recordHashUid = '';
storage.setOrCreate('commandGetAccountInfo', '');
if ([
Constants.ERR_CODE_NETWORK_ERROR,
Constants.ERR_CODE_CONNECTION_FAIL,
Constants.ERR_CODE_CONNECTION_TIME_OUT
].includes(Number(commandGetAccountInfoCallBack.errorCode))) {
this.showToast($r('app.string.network_invalid'));
return;
try {
let commandGetAccountInfoCallBack = JSON.parse(this.commandGetAccountInfo) as Record<string, object>;
HiLog.info(TAG, `commandGetAccountInfo Call Back errorCode: ${commandGetAccountInfoCallBack.errorCode}`);
let res = commandGetAccountInfoCallBack.result as Record<string, string>;
if (Number(commandGetAccountInfoCallBack.errorCode) === Constants.ERR_CODE_SUCCESS && res?.uid) {
this.ownerAccount = res?.uid;
this.ownerAccountID = res?.uid;
this.connectService.connectServiceShareAbility(Constants.COMMAND_SEARCH_USER_INFO);
} else {
this.enabledFocus = true;
this.isConfirmButtonEnabled = true;
this.recordHashUid = '';
storage.setOrCreate('commandGetAccountInfo', '');
if ([
Constants.ERR_CODE_NETWORK_ERROR,
Constants.ERR_CODE_CONNECTION_FAIL,
Constants.ERR_CODE_CONNECTION_TIME_OUT
].includes(Number(commandGetAccountInfoCallBack.errorCode))) {
this.showToast($r('app.string.network_invalid'));
return;
}
this.showToast($r('app.string.Share_File_Encrypted_Failed'));
}
this.showToast($r('app.string.Share_File_Encrypted_Failed'));
} catch (error) {
HiLog.error(TAG, `get account info failed: ${JSON.stringify(error)}`);
this.showToast($r('app.string.network_invalid'));
this.enabledFocus = true;
this.isConfirmButtonEnabled = this.inputValue.length > 0;
}
}