hpp-util 6.0.0
Debugging tools for the HPP project.
Loading...
Searching...
No Matches
Macros for\c std::exception

Macros

#define HPP_THROW(TYPE, MSG)    throw ::hpp::ExceptionFactory<TYPE>() << MSG << ::hpp::ThrowException()
 Throw an exception of type using MSG as a string stream.
 
#define HPP_THROW_WITH_LINEINFO(TYPE, MSG)    HPP_THROW(TYPE, MSG << " at " << __FILE__ << ":" << __LINE__)
 Throw an exception of type using MSG as a string stream.
 

Detailed Description

It eases throwing exceptions built from string stream. You can use equivalently

HPP_THROW(std::runtime_error, "message" << variable);
#define HPP_THROW(TYPE, MSG)
Throw an exception of type using MSG as a string stream.
Definition exception-factory.hh:109

or

HPP_THROW_WITH_LINEINFO(std::runtime_error, "message" << variable);
#define HPP_THROW_WITH_LINEINFO(TYPE, MSG)
Throw an exception of type using MSG as a string stream.
Definition exception-factory.hh:116

or

throw ::hpp::ExceptionFactory<std::runtime_error>() << "message" <<
variable << ::hpp::ThrowException();
Class to ease exception creation.
Definition exception-factory.hh:73

Macro Definition Documentation

◆ HPP_THROW

#define HPP_THROW (   TYPE,
  MSG 
)     throw ::hpp::ExceptionFactory<TYPE>() << MSG << ::hpp::ThrowException()

Throw an exception of type using MSG as a string stream.

HPP_THROW(std::runtime_error, "message" << variable);

◆ HPP_THROW_WITH_LINEINFO

#define HPP_THROW_WITH_LINEINFO (   TYPE,
  MSG 
)     HPP_THROW(TYPE, MSG << " at " << __FILE__ << ":" << __LINE__)

Throw an exception of type using MSG as a string stream.

HPP_THROW_WITH_LINEINFO(std::runtime_error>, "message" << variable);