401整改,修改异常抛出方式

Signed-off-by: 陈怡博 <chenyibo6@huawei.com>
This commit is contained in:
陈怡博 2024-04-30 10:41:29 +08:00
parent 96516bae88
commit 2dc6214156
2 changed files with 6 additions and 6 deletions

View File

@ -353,7 +353,7 @@ static napi_value GrantUidAsyncWork(napi_env env, GrantAsyncContext context)
napi_status status = napi_queue_async_work(env, context->asyncWork);
if (status != napi_ok) {
napi_throw(env, GenerateBusinessError(env, INNER_FAILURE, "queue asyncWork error"));
ThrowParamsError(env, INNER_FAILURE, "queue asyncWork error");
CM_LOG_E("get async work failed when granting uid");
return nullptr;
}
@ -377,7 +377,7 @@ static napi_value RemoveUidAsyncWork(napi_env env, GrantAsyncContext context)
napi_status status = napi_queue_async_work(env, context->asyncWork);
if (status != napi_ok) {
napi_throw(env, GenerateBusinessError(env, INNER_FAILURE, "queue asyncWork error"));
ThrowParamsError(env, INNER_FAILURE, "queue asyncWork error");
CM_LOG_E("queue async work failed when removing uid");
return nullptr;
}
@ -401,7 +401,7 @@ static napi_value IsAuthedAsyncWork(napi_env env, GrantAsyncContext context)
napi_status status = napi_queue_async_work(env, context->asyncWork);
if (status != napi_ok) {
napi_throw(env, GenerateBusinessError(env, INNER_FAILURE, "queue asyncWork error"));
ThrowParamsError(env, INNER_FAILURE, "queue asyncWork error");
CM_LOG_E("queue async work failed when using isAuthed");
return nullptr;
}
@ -425,7 +425,7 @@ static napi_value GetUidListAsyncWork(napi_env env, GrantAsyncContext context)
napi_status status = napi_queue_async_work(env, context->asyncWork);
if (status != napi_ok) {
napi_throw(env, GenerateBusinessError(env, INNER_FAILURE, "queue asyncWork error"));
ThrowParamsError(env, INNER_FAILURE, "queue asyncWork error");
CM_LOG_E("queue async work failed when getting authed uid list");
return nullptr;
}

View File

@ -356,7 +356,7 @@ static napi_value MallocFinishOutData(napi_env env, SignVerifyAsyncContext conte
context->signature = static_cast<CmBlob *>(CmMalloc(sizeof(CmBlob)));
if (context->signature == nullptr) { /* signature will free after all process */
CM_LOG_E("malloc outData failed when process sign finish");
napi_throw(env, GenerateBusinessError(env, INNER_FAILURE, "malloc failed"));
ThrowParamsError(env, INNER_FAILURE, "malloc failed");
return nullptr;
}
(void)memset_s(context->signature, sizeof(CmBlob), 0, sizeof(CmBlob));
@ -364,7 +364,7 @@ static napi_value MallocFinishOutData(napi_env env, SignVerifyAsyncContext conte
uint8_t *data = static_cast<uint8_t *>(CmMalloc(OUT_SIGNATURE_SIZE));
if (data == nullptr) {
CM_LOG_E("malloc outData.data failed when process sign finish");
napi_throw(env, GenerateBusinessError(env, INNER_FAILURE, "malloc failed"));
ThrowParamsError(env, INNER_FAILURE, "malloc failed");
return nullptr;
}
(void)memset_s(data, OUT_SIGNATURE_SIZE, 0, OUT_SIGNATURE_SIZE);