HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
Exceptions

Exceptions and error handling. More...

Classes

class  IOError
 Thrown when some I/O operation fails. More...
 
class  StateError
 Thrown when some unexpected state is encountered. More...
 
class  SizeError
 Thrown when an unexpected container size is encountered. More...
 
class  ValueError
 Thrown when an inappropriate value is encountered. More...
 
class  SampleRateError
 Thrown when sample rate is mismatched. More...
 
class  ChannelLayoutError
 Thrown when a numbers of channels is mismatched. More...
 
class  HartAssertException
 Thrown when hassert() or hassertfalse are triggered. More...
 
class  UnsupportedError
 Thrown when some parameter has an unsupported value. More...
 
class  ConfigurationError
 Thrown when the test runner is misconfigured. More...
 
class  IndexError
 Thrown when a container index is out of range. More...
 
class  NullPointerError
 Thrown when a nullptr could be handled gracefully. More...
 

Macros

#define HART_THROW(ExceptionType, message)   do { HART_THROW_IMPL(ExceptionType, message); } while (0)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message otherwise.
 
#define HART_THROW_OR_RETURN(ExceptionType, message, returnValue)   HART_THROW (ExceptionType, message)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns a specified value otherwise.
 
#define HART_THROW_OR_RETURN_VOID(ExceptionType, message)   HART_THROW (ExceptionType, message)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns otherwise.
 
#define HART_THROW_OR_CONTINUE(ExceptionType, message)   HART_THROW (ExceptionType, message)
 Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and jumps to the next iteration (via continue) otherwise.
 
#define hassertfalse   HART_THROW (hart::HartAssertException, "hassertfalse failed")
 Triggers a HartAssertException
 
#define hassert(condition)   if (! (condition)) { HART_THROW (hart::HartAssertException, std::string ("hassert failed:") + #condition); }
 Triggers a HartAssertException if the condition is false
 
#define HART_WARNING(message)   std::cout << "Warning: " << message << ", file: " << __FILE__ << ", line: " << __LINE__ << std::endl
 Prints a warning message.
 

Detailed Description

Exceptions and error handling.

Macro Definition Documentation

◆ HART_THROW

#define HART_THROW (   ExceptionType,
  message 
)    do { HART_THROW_IMPL(ExceptionType, message); } while (0)

Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message otherwise.

Definition at line 141 of file hart_exceptions.hpp.

◆ HART_THROW_OR_RETURN

#define HART_THROW_OR_RETURN (   ExceptionType,
  message,
  returnValue 
)    HART_THROW (ExceptionType, message)

Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns a specified value otherwise.

Definition at line 145 of file hart_exceptions.hpp.

◆ HART_THROW_OR_RETURN_VOID

#define HART_THROW_OR_RETURN_VOID (   ExceptionType,
  message 
)    HART_THROW (ExceptionType, message)

Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and returns otherwise.

Definition at line 149 of file hart_exceptions.hpp.

◆ HART_THROW_OR_CONTINUE

#define HART_THROW_OR_CONTINUE (   ExceptionType,
  message 
)    HART_THROW (ExceptionType, message)

Throws an exception if HART_DO_NOT_THROW_EXCEPTIONS is set, prints a message and jumps to the next iteration (via continue) otherwise.

Definition at line 153 of file hart_exceptions.hpp.

◆ hassertfalse

#define hassertfalse   HART_THROW (hart::HartAssertException, "hassertfalse failed")

Triggers a HartAssertException

Definition at line 160 of file hart_exceptions.hpp.

◆ hassert

#define hassert (   condition)    if (! (condition)) { HART_THROW (hart::HartAssertException, std::string ("hassert failed:") + #condition); }

Triggers a HartAssertException if the condition is false

Definition at line 164 of file hart_exceptions.hpp.

◆ HART_WARNING

#define HART_WARNING (   message)    std::cout << "Warning: " << message << ", file: " << __FILE__ << ", line: " << __LINE__ << std::endl

Prints a warning message.

Definition at line 168 of file hart_exceptions.hpp.