diff --git a/interfaces/kits/js/src/common/uni_error.cpp b/interfaces/kits/js/src/common/uni_error.cpp index 35f8db1b4c508b535539f8f05806e648b825ea2f..05395ca437ffa5a40f3b96b60042cd88da2ec87f 100644 --- a/interfaces/kits/js/src/common/uni_error.cpp +++ b/interfaces/kits/js/src/common/uni_error.cpp @@ -35,6 +35,7 @@ static napi_value GenerateBusinessError(napi_env env, int32_t errCode, string er msg = NVal::CreateUTF8String(env, errMsg).val_; napi_create_error(env, nullptr, msg, &businessError); napi_set_named_property(env, businessError, FILEIO_TAG_ERR_CODE.c_str(), code); + napi_set_named_property(env, businessError, FILEIO_TAG_ERR_MSG.c_str(), msg); return businessError; } diff --git a/interfaces/kits/js/src/common/uni_error.h b/interfaces/kits/js/src/common/uni_error.h index 80fdc437c63300817e3710c1ca04b0ea837c137c..b9d2b7a303dff27f623747fef517cbc47a2d07b2 100644 --- a/interfaces/kits/js/src/common/uni_error.h +++ b/interfaces/kits/js/src/common/uni_error.h @@ -26,6 +26,7 @@ namespace DistributedFS { constexpr int ERRNO_NOERR = 0; constexpr int FILEIO_SYS_CAP_TAG = 13900000; const std::string FILEIO_TAG_ERR_CODE = "code"; +const std::string FILEIO_TAG_ERR_MSG = "message"; enum ELegacy { ELEGACY_INVAL = 202,