Throw std::system_error if a file could not be opened in io::file_stream
This commit is contained in:
parent
1a06f5071d
commit
0979b55f72
1 changed files with 1 additions and 1 deletions
|
|
@ -8,7 +8,7 @@ namespace psemek::io
|
||||||
|
|
||||||
static void throw_fopen [[noreturn]] (std::filesystem::path const & path)
|
static void throw_fopen [[noreturn]] (std::filesystem::path const & path)
|
||||||
{
|
{
|
||||||
throw std::runtime_error("Failed to open " + path.string() + ": " + std::string(std::strerror(errno)));
|
throw std::system_error(std::error_code{errno, std::system_category()}, "Failed to open " + path.string());
|
||||||
}
|
}
|
||||||
|
|
||||||
static FILE * safe_fopen(std::filesystem::path const & path, const char * mode)
|
static FILE * safe_fopen(std::filesystem::path const & path, const char * mode)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue