From 72633f9bf5f38d21cd5a03c670d9f204dfdd36f7 Mon Sep 17 00:00:00 2001 From: zhangzhiwei Date: Mon, 8 Apr 2024 10:19:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangzhiwei --- .../kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp | 2 +- interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp | 5 ++++- interfaces/kits/js/src/mod_fs/properties/stat.cpp | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp b/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp index 22b8385f8..dae4d4775 100644 --- a/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fs/class_stream/stream_n_exporter.cpp @@ -208,7 +208,7 @@ napi_value StreamNExporter::Write(napi_env env, napi_callback_info cbInfo) auto streamEntity = NClass::GetEntityOf(env, funcArg.GetThisVar()); if (!streamEntity || !streamEntity->fp) { - HILOGE("Failed to get entity of Stream"); + HILOGD("Failed to get entity of Stream"); NError(EIO).ThrowErr(env); return nullptr; } diff --git a/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp b/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp index 3d7b0ecae..2f1ca10c9 100644 --- a/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/prop_n_exporter.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ +#define SPECIAL_ERROR -2 #include "prop_n_exporter.h" #include @@ -263,7 +264,9 @@ napi_value PropNExporter::UnlinkSync(napi_env env, napi_callback_info info) } int ret = uv_fs_unlink(nullptr, unlink_req.get(), path.get(), nullptr); if (ret < 0) { - HILOGE("Failed to unlink with path"); + if (ret != SPECIAL_ERROR) { + HILOGE("Failed to unlink with path"); + } NError(ret).ThrowErr(env); return nullptr; } diff --git a/interfaces/kits/js/src/mod_fs/properties/stat.cpp b/interfaces/kits/js/src/mod_fs/properties/stat.cpp index 26e44c86e..bb52647ad 100644 --- a/interfaces/kits/js/src/mod_fs/properties/stat.cpp +++ b/interfaces/kits/js/src/mod_fs/properties/stat.cpp @@ -12,6 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#define SPE_ERROR -2 #include "stat.h" #include @@ -58,7 +59,9 @@ static NError CheckFsStat(const FileInfo &fileInfo, uv_fs_t* req) if (fileInfo.isPath) { int ret = uv_fs_stat(nullptr, req, fileInfo.path.get(), nullptr); if (ret < 0) { + if (ret != SPE_ERROR) { HILOGE("Failed to stat file with path"); + } return NError(ret); } } else { -- Gitee