Any other FeyGamesFramework Module depends on Errors Module. So you always have to include it and choose an implementation of it.
How it works
The first parameter is an operation that returns boolean value (true or false) and the second is std::wstring error message that will be used if error occurred (the operation returned false).
So for example:
Any of FeyGamesFramework Modules uses the similar way to handle such situations.
How errors handler will behave
They are 3 customizable aspects of error handling:
Notification can be set to:
- silent (you won't see any notification),
- inform (basic information that error has occurred, good for release version of the game),
- inform with details (the full details of error, good for debugging the game).
Interruption (do you want application to quit after delivering an error?) and logging (would you like to make an log file?) have to possible values: yes and no.
By default, FeyGamesFramework uses:
- notification = inform,
- interruption = no,
- logging = no.
You can change that for each Module separately by using:
Those statements have to be done before you will create and initialize any of Modules, including Errors Module itself.
After that, you should immediately create an ErrorsHandler:
From now on, errors handling will work for you. And now you can create an initialize the rest of Modules.
- Check error handling for user-defined errors (without MODULE_CODE).
- Errors::ErrorsHandler::setErrorHandling() vs Errors::setErrorHandling().
- Logging an error.