summaryrefslogtreecommitdiffstats
path: root/parallel-libs/streamexecutor/lib/Utils/Error.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'parallel-libs/streamexecutor/lib/Utils/Error.cpp')
-rw-r--r--parallel-libs/streamexecutor/lib/Utils/Error.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/parallel-libs/streamexecutor/lib/Utils/Error.cpp b/parallel-libs/streamexecutor/lib/Utils/Error.cpp
index f3d09673c21..15a9ccbed98 100644
--- a/parallel-libs/streamexecutor/lib/Utils/Error.cpp
+++ b/parallel-libs/streamexecutor/lib/Utils/Error.cpp
@@ -60,4 +60,12 @@ std::string consumeAndGetMessage(Error &&E) {
return Message;
}
+void dieIfError(Error &&E) {
+ if (E) {
+ std::fprintf(stderr, "Error encountered: %s.\n",
+ streamexecutor::consumeAndGetMessage(std::move(E)).c_str());
+ std::exit(EXIT_FAILURE);
+ }
+}
+
} // namespace streamexecutor
OpenPOWER on IntegriCloud