aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/errors.h
diff options
context:
space:
mode:
authorGravatar László Csomor <laszlocsomor@google.com>2017-01-27 11:01:41 +0000
committerGravatar Laszlo Csomor <laszlocsomor@google.com>2017-01-27 13:43:08 +0000
commit6f1e31a9aa4ad80e402b9a441d4129c7f1bd6fb7 (patch)
tree196001f4d4e155189fef6c5e4e2d677ae6f4e8e1 /src/main/cpp/util/errors.h
parent7e7d6094b26e906ea0714e3b006f1458dfc3b825 (diff)
Bazel client: platform-dependent `strerror`
Move `strerror` calls into errors_<platform>. We have to get rid of direct `errno` reading too, because it doesn't work on Windows native. Fixes https://github.com/bazelbuild/bazel/issues/2411 -- Change-Id: I69ff502487d698aa9e9147f02fd0bc5253e94e64 Reviewed-on: https://cr.bazel.build/8490 PiperOrigin-RevId: 145777524 MOS_MIGRATED_REVID=145777524
Diffstat (limited to 'src/main/cpp/util/errors.h')
-rw-r--r--src/main/cpp/util/errors.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/main/cpp/util/errors.h b/src/main/cpp/util/errors.h
index 833a6ee473..e7d93068f4 100644
--- a/src/main/cpp/util/errors.h
+++ b/src/main/cpp/util/errors.h
@@ -18,6 +18,7 @@
#ifndef BAZEL_SRC_MAIN_CPP_UTIL_ERRORS_H_
#define BAZEL_SRC_MAIN_CPP_UTIL_ERRORS_H_
+#include <string>
#include "src/main/cpp/util/port.h"
namespace blaze_util {
@@ -30,6 +31,11 @@ void pdie(const int exit_status, const char *format, ...) ATTRIBUTE_NORETURN
PRINTF_ATTRIBUTE(2, 3);
void PrintError(const char *format, ...) PRINTF_ATTRIBUTE(1, 2);
+// Returns the last error as a platform-specific error message.
+// The string will also contain the platform-specific error code itself
+// (which is `errno` on Linux/Darwin, and `GetLastError()` on Windows).
+std::string GetLastErrorString();
+
} // namespace blaze_util
#endif // BAZEL_SRC_MAIN_CPP_UTIL_ERRORS_H_