diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2026-06-05 09:05:03 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2026-06-05 09:05:03 +0200 |
| commit | c1c317014002311874006f319b04121c88ef4672 (patch) | |
| tree | 0c577bd0d09fa66abd45b6585a9442480219d000 /cabinet/magic.hpp | |
| parent | 81fa478a642b25715adecf27c283e6f15334d705 (diff) | |
| download | cabinet-c1c317014002311874006f319b04121c88ef4672.tar.xz cabinet-c1c317014002311874006f319b04121c88ef4672.zip | |
magic: improve error handling
Diffstat (limited to 'cabinet/magic.hpp')
| -rw-r--r-- | cabinet/magic.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/cabinet/magic.hpp b/cabinet/magic.hpp index 96f4b08..9e078de 100644 --- a/cabinet/magic.hpp +++ b/cabinet/magic.hpp @@ -54,10 +54,12 @@ namespace cab auto operator=(magic const &) -> magic & = delete; auto operator=(magic && other) noexcept -> magic &; - auto process(std::filesystem::path path) -> std::expected<std::string, std::string>; - auto process(int file_descriptor) -> std::expected<std::string, std::string>; + auto process(std::filesystem::path path) -> std::expected<std::string, std::error_code>; + auto process(int file_descriptor) -> std::expected<std::string, std::error_code>; private: + auto handle_result(char const * result) -> std::expected<std::string, std::error_code>; + explicit magic(::magic_t cookie) noexcept; ::magic_t m_cookie{}; |
