TurtleBrains  0.3.1
High quality, portable, C++ framework for rapid 2D game development.
Error Handling Macros


#define tb_error(message, ...)   { tbCore::Error::TriggerError(__FILE__, __LINE__, message, ##__VA_ARGS__); }
#define tb_error_if(errorTest, message, ...)   { tbCore::Error::TriggerErrorIf((errorTest), __FILE__, __LINE__, message, ##__VA_ARGS__); }

Detailed Description

Macro Definition Documentation

#define tb_error (   message,
)    { tbCore::Error::TriggerError(__FILE__, __LINE__, message, ##__VA_ARGS__); }

Creates formatted message like using printf and outputs to stdout before proceeding to trigger an error condition then invokes OnErrorFired() on each ErrorHandlerInterface that has been added to the handler list by calling: TurtleBrains::Core::Error::AddErrorHandler().

#define tb_error_if (   errorTest,
)    { tbCore::Error::TriggerErrorIf((errorTest), __FILE__, __LINE__, message, ##__VA_ARGS__); }

If the errorTest condition passes, print out message using printf, then invoke OnErrorFired() on each ErrorHandlerInterface that has been added via TurtleBrains::Core::Error::AddErrorHandler.

errorTestAn expression that will be evaluated to true/false.
messageA printf formatted const char* const null-terminated string with information about the failure.
...The parameters that should be used with the printf formatted string.
See also
printf documentation
#include "turtle_brains/core/tb_error.h"
int main(int argumentCount, char* argumentValues[])
//The error will be triggered if the test is true. tb_error_if(test == true, "Information about error.");
tb_error_if(std::string("Hello World") != "Hello World", "Expected the Hello World strings to match!");
return 0;