aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.config/read.cc
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-06-26 18:58:44 +0100
committerLexi Winter <lexi@le-fay.org>2025-06-26 18:58:44 +0100
commit1db86c401df11423c945634d8b2a483e97afa878 (patch)
treeb4cf433a8511e391a432f02f66f5817c6c395a4a /nihil.config/read.cc
parent257b6719ed89104018f6a521f6141ecd3eec3fd9 (diff)
downloadnihil-1db86c401df11423c945634d8b2a483e97afa878.tar.gz
nihil-1db86c401df11423c945634d8b2a483e97afa878.tar.bz2
nihil: improve error handling
Diffstat (limited to 'nihil.config/read.cc')
-rw-r--r--nihil.config/read.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/nihil.config/read.cc b/nihil.config/read.cc
index 3c20566..0a5fcad 100644
--- a/nihil.config/read.cc
+++ b/nihil.config/read.cc
@@ -4,6 +4,7 @@
module;
+#include <coroutine>
#include <expected>
#include <filesystem>
#include <format>
@@ -27,7 +28,7 @@ auto read_from(std::filesystem::path const &filename)
if (!err) {
// Ignore ENOENT, it simply means we haven't created the
// config file yet, so default values will be used.
- if (err.error() == std::errc::no_such_file_or_directory)
+ if (err.error().root_cause() == std::errc::no_such_file_or_directory)
return {};
auto errstr = std::format("cannot read {}", filename.string());
return std::unexpected(nihil::error(errstr, err.error()));