Description:fix error code

Match-id-451bcfa54b7eec1b243e495cd377ad671f0a8bef
This commit is contained in:
li-li-wang 2023-08-12 14:14:01 +08:00 committed by baoyang
parent 431898070d
commit ec53fa9129
2 changed files with 12 additions and 6 deletions

View File

@ -125,9 +125,12 @@ export default class Constants {
static ERR_JS_APP_PARAM_ERROR = 4;
static ERR_JS_APP_GET_FILE_ASSET_ERROR = 5;
static ERR_JS_CREDENTIAL_TIMEOUT = 19100003;
static ERR_JS_CREDENTIAL_SERVICE_ERROR = 19100004;
static ERR_JS_CREDENTIAL_SERVER_ERROR = 19100005;
static ERR_JS_NOT_DLP_FILE = 19100008;
static ERR_JS_DLP_FILE_READ_ONLY = 19100010;
static ERR_JS_USER_NO_PERMISSION = 19100013;
static ERR_JS_ACCOUNT_NOT_LOGIN = 19100014;
static ERR_JS_INVALID_PARAMETER = 12300002;
static ERR_JS_ACCOUNT_NOT_FOUND = 12300003;
static DLP_FILE_PARSE_ERROR = 103;

View File

@ -102,16 +102,24 @@ function terminateSelfWithResult(resultCode: number, result: string): void {
function getAlertMessage(err, defaultTitle?: Resource, defaultMessage?: Resource) {
switch (err.code) {
case Constants.ERR_JS_USER_NO_PERMISSION:
return {
'title': $r('app.string.TITLE_APP_VISIT_FILE_ERROR'),
'msg': $r('app.string.MESSAGE_APP_NOT_HAVE_PERM_VISIT', err.extra)
}
case Constants.ERR_JS_APP_INSIDE_ERROR:
return { 'title': $r('app.string.TITLE_APP_ERROR'), 'msg': $r('app.string.MESSAGE_APP_INSIDE_ERROR') };
case Constants.ERR_JS_GET_ACCOUNT_ERROR:
return { 'title': $r('app.string.TITLE_APP_ERROR'), 'msg': $r('app.string.MESSAGE_APP_GET_ACCOUNT_ERROR') };
case Constants.ERR_JS_APP_NO_ACCOUNT_ERROR:
case Constants.ERR_JS_ACCOUNT_NOT_LOGIN:
return { 'title': $r('app.string.TITLE_APP_ERROR'), 'msg': $r('app.string.MESSAGE_APP_NO_ACCOUNT_ERROR') };
case Constants.ERR_JS_APP_PARAM_ERROR:
return { 'title': $r('app.string.TITLE_APP_ERROR'), 'msg': $r('app.string.MESSAGE_APP_PARAM_ERROR') };
case Constants.ERR_JS_APP_GET_FILE_ASSET_ERROR:
return { 'title': $r('app.string.TITLE_APP_ERROR'), 'msg': $r('app.string.MESSAGE_APP_GET_FILE_ASSET_ERROR') };
case Constants.ERR_JS_CREDENTIAL_SERVICE_ERROR:
return { 'title': $r('app.string.TITLE_SERVICE_ERROR'), 'msg': $r('app.string.MESSAGE_SERVICE_INSIDE_ERROR') };
case Constants.ERR_JS_CREDENTIAL_SERVER_ERROR:
return { 'title': $r('app.string.TITLE_SERVICE_ERROR'), 'msg': $r('app.string.MESSAGE_DLP_CREDENTIAL_SERVER_ERROR') };
case Constants.ERR_JS_NOT_DLP_FILE:
@ -121,12 +129,7 @@ function getAlertMessage(err, defaultTitle?: Resource, defaultMessage?: Resource
case Constants.ERR_JS_DLP_FILE_READ_ONLY:
return { 'title': $r('app.string.TITLE_OPERATE_DENY'), 'msg': $r('app.string.MESSAGE_DLP_READ_ONLY') };
default:
if (err.extra != undefined) { // has contact account
return {
'title': $r('app.string.TITLE_APP_VISIT_FILE_ERROR'),
'msg': $r('app.string.MESSAGE_APP_NOT_HAVE_PERM_VISIT', err.extra)
}
} else if (defaultTitle !== undefined && defaultMessage != undefined) {
if (defaultTitle !== undefined && defaultMessage != undefined) {
return { 'title': defaultTitle, 'msg': defaultMessage };
} else {
return { 'title': $r('app.string.TITLE_APP_ERROR'), 'msg': $r('app.string.MESSAGE_APP_INSIDE_ERROR') };