<< Click to Display Table of Contents >> Navigation: Using SMILE > Error handling |
Most SMILE functions and methods return an integer status code. Negative numbers are used for specific error codes. For a complete list of codes, see the Error codes section in the Reference Manual.
Sometimes SMILE emits a warning or an error message. By default, your program is not notified about these messages: you need to query the information stored in a global instance of DSL_errorStringHandler, accessible through the DSL_errorH function. It is also possible to redirect the error output to FILE* (including stdout or stderr):
DSL_errorH().RedirectToFile(stdout);
For the complete control over warnings and error messages, use DSL_errorStringHandler::Redirect method. Its only argument of this method is a pointer to the instance of the class derived from DSL_errorStringRedirect.
class MyRedirect : public DSL_errorStringRedirect
{
public:
void LogError(int code, const char *message)
{
// do something with the code and message
}
};
// …
MyRedirect myRedir;
DSL_errorH().Redirect(&myRedir);
Tutorials included in this manual redirect errors to stdout.