summaryrefslogtreecommitdiffstatshomepage
path: root/src/error.cpp
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-04 23:00:02 +0200
committerEgor Tensin <egor@tensin.name>2026-06-04 23:00:02 +0200
commit3333f7cc6e5bee683ae7349ed86304e20db5a675 (patch)
tree81d2d574b9a21af6f9e56325fba8dc418ad7b3e3 /src/error.cpp
parentupgrade to std::optional (diff)
downloadwinapi-common-3333f7cc6e5bee683ae7349ed86304e20db5a675.tar.gz
winapi-common-3333f7cc6e5bee683ae7349ed86304e20db5a675.zip
upgrade to std::format
Diffstat (limited to '')
-rw-r--r--src/error.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/error.cpp b/src/error.cpp
index 3fd18ea..afc33f3 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -9,7 +9,7 @@
#include <windows.h>
#include <cstdint>
-#include <sstream>
+#include <format>
#include <string>
#include <string_view>
#include <system_error>
@@ -27,9 +27,7 @@ std::wstring trim_trailing_newline(std::wstring_view s) {
}
std::string build_what(DWORD code, std::string_view function) {
- std::ostringstream what;
- what << "Function " << function << " failed with error code " << code;
- return what.str();
+ return std::format("Function {} failed with error code {}", function, code);
}
std::string format_message(int32_t code) {