C++ Error handler


I want to know what are the best ways to deal with errors.
Basically I want to stop running the application.

For example:

void foo()
int a = 0;
if (a != true)
myErrorHandler::postMessage("a variable it's not true");

Something like that
You can throw an exception.
throw an exception. If it will be left unhandled it will stop your programm.
And if it isn't a critical error, you can catch it and deal with it.
Topic archived. No new replies allowed.