Get Error Message

The engine.
Post Reply
jdtoellner
Posts: 71
Joined: Mon Aug 01, 2016 9:45 pm

Get Error Message

Post by jdtoellner »

I tried to get an error string with GetErrorMessage.

Code: Select all

DSL_errorStringHandler errorHandler;
cout << errorHandler.GetErrorMessage(-2) << endl;
It doesn't work.
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Re: Get Error Message

Post by shooltz[BayesFusion] »

I believe you're trying to translate the error code (-2) into the string. This is not actually possible; when code in SMILE logs an error it passes an error code and a string which may include context-specific information, like node ID etc. You may consider using this approach instead:

Code: Select all

cout << ErrorH.GetLastErrorMessage() << endl
You can also redirect all errors to console or to file with ErrorH.RedirectToFile. An advanced option is to use DSL_errorStringRedirect to provide your own class which is notified whenever something gets logged.
Post Reply