From 62d0579f40bad7d56065c9c93d84bcfa265025a6 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 19 Feb 2025 21:47:47 -0600 Subject: [PATCH] [ox/fs] Restructure stat error handling to make easier to debug --- deps/ox/src/ox/fs/filesystem/passthroughfs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp index fbf960bd..d6f3cf98 100644 --- a/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp +++ b/deps/ox/src/ox/fs/filesystem/passthroughfs.cpp @@ -93,7 +93,9 @@ Result PassThroughFS::statPath(StringViewCR path) const noexcept { oxTracef("ox.fs.PassThroughFS.statInode", "{} {}", ec.message(), path); const uint64_t size = type == FileType::Directory ? 0 : std::filesystem::file_size(p, ec); oxTracef("ox.fs.PassThroughFS.statInode.size", "{} {}", path, size); - OX_RETURN_ERROR(ox::Error(static_cast(ec.value()), "PassThroughFS: stat failed")); + if (auto err = ec.value()) { + return ox::Error{static_cast(err), "PassThroughFS: stat failed"}; + } return FileStat{0, 0, size, type}; }