diff options
-rw-r--r-- | modules/core/c++/error.hpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/core/c++/error.hpp b/modules/core/c++/error.hpp index 790281d..b4a9504 100644 --- a/modules/core/c++/error.hpp +++ b/modules/core/c++/error.hpp @@ -285,4 +285,17 @@ bool error::is_type() const { return error_code_ == impl::get_template_id<T>(); } +#define SAW_CHECK_AND_PRINT(ErrorName, ValueName, ErrStream) \ + if(ErrorName.is_error()) [[unlikely]] { \ + auto& err = ErrorName.get_error(); \ + ErrStream << "Error: "<< err.get_category(); \ + auto err_msg = err.get_message(); \ + if(!err_msg.empty()){ \ + ErrStream << " - " << err_msg; \ + } \ + ErrStream << std::endl; \ + } \ + auto& ValueName = ErrorName.get_value(); + + } // namespace saw |