SlHelpers
Loading...
Searching...
No Matches
SlHelpers::RuntimeException Class Reference

Class for easier construction of std::runtime_error. More...

#include <Exception.h>

Classes

struct  ThrowNow

Public Member Functions

 RuntimeException (std::string_view str)
 Construct new RuntimeException, having str as the initial exception string.
template<typename T>
RuntimeException & operator<< (const T &msg)
 Add more to the exception string.
std::string str () const
 Return the stored exception string.
auto getRE () const
 Create and return std::runtime_error.
void raise () const
 Create and throw std::runtime_error.
void operator<< (const ThrowNow &)
 Create and throw std::runtime_error.

Detailed Description

Class for easier construction of std::runtime_error.

To be used as:

RuntimeException("This failed: ") << reason << raise;
void raise() const
Create and throw std::runtime_error.
Definition Exception.h:44

It is always necessary to use either SlHelpers::raise, or raise() to throw, or getRE() to obtain the exception.


The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/slhelpers-20260428.f233ce9-build/slhelpers-20260428.f233ce9/include/helpers/Exception.h