summaryrefslogtreecommitdiff
path: root/src/support/utilities.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/support/utilities.h')
-rw-r--r--src/support/utilities.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/support/utilities.h b/src/support/utilities.h
index d8ca23463..3ff1f9c5e 100644
--- a/src/support/utilities.h
+++ b/src/support/utilities.h
@@ -54,6 +54,24 @@ std::unique_ptr<T> make_unique(Args&&... args)
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
+// For fatal errors which could arise from input (i.e. not assertion failures)
+class Fatal {
+ public:
+ Fatal() {
+ std::cerr << "Fatal: ";
+ }
+ template<typename T>
+ Fatal &operator<<(T arg) {
+ std::cerr << arg;
+ return *this;
+ }
+ ~Fatal() {
+ std::cerr << "\n";
+ exit(1);
+ }
+};
+
+
} // namespace wasm
#endif // wasm_support_utilities_h