system/FmtError: new library

Replaces the Format*() functions in system/Error.hxx.
This commit is contained in:
Max Kellermann
2022-11-28 18:49:35 +01:00
parent 124e75c286
commit 96ae659fdf
25 changed files with 305 additions and 186 deletions

View File

@@ -18,7 +18,8 @@
*/
#include "DirectoryReader.hxx"
#include "system/Error.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "system/FmtError.hxx"
#ifdef _WIN32
@@ -28,7 +29,7 @@ DirectoryReader::DirectoryReader(Path dir)
:handle(FindFirstFile(MakeWildcardPath(dir.c_str()), &data))
{
if (handle == INVALID_HANDLE_VALUE)
throw FormatLastError("Failed to open %s", dir.c_str());
throw FmtLastError("Failed to open {}", dir);
}
#else
@@ -37,7 +38,7 @@ DirectoryReader::DirectoryReader(Path dir)
:dirp(opendir(dir.c_str()))
{
if (dirp == nullptr)
throw FormatErrno("Failed to open %s", dir.c_str());
throw FmtErrno("Failed to open {}", dir);
}
#endif