Exception propagation
If I have a c++ class I have registered with AS and in a call to a method of the object used in a script my method throws an exception, is there anyway to propagate that up to the script engine and report it as a script error? Thanks, Scott
[size=1]'Behold! It is not over unknown seas but back over well-known years that your quest must go; back to the bright strange things of infancy and the quick sun-drenched glimpses of magic that old scenes brought to wide young eyes.'
There is currently no automatic treatment of C++ exceptions. You'll need to write a wrapper for the class method that catches the exception and raises a script exception instead.
Example:
Example:
void MyWrapper(obj *o){ try { o->DoSomething(); } catch( E& e ) { asIScriptContext *ctx = asGetActiveContext(); if( ctx ) ctx->SetException("An exception occured"); }}
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement