-
-
Notifications
You must be signed in to change notification settings - Fork 235
Error protection
Doug Binks edited this page Sep 26, 2013
·
2 revisions
It's easy to make a mistake when editing code, so we have developed a system to provide error recovery.
In order to protect a given section of code from errors, encapsulate it in a class derived from RuntimeProtector:
struct ExampleProtection : public RuntimeProtector
{
virtual void ProtectedFunc()
{
// code here is protected
}
} g_Protected;
This can then be safely called via:
pRuntimeObjectSystem->TryProtectedFunction( &g_Protected );
To re-enable the protected function, call the g_Protected.ClearExceptions();. This is automatically done when after new code has been loaded after a runtime compile.