If I throw a script exception from a factory function, aka a C++ constructor registered as a script factory function for a reference type, I get this assertion error:
Assertion failed: (m_regs.objectType != 0), function CleanReturnObject, file ../angelscript/source/as_context.cpp, line 4589.
More specifically, I'm writing a C++ class to wrap a network socket for script usage. In the Socket() constructor I have the usual BSD socket(), setsockopt() etc. procedure. I'm erroring out if each call fails and letting the script know via script exceptions which part of the process failed. The class is registered as a reference type in angelscript and has the normal addRef/release logic with `if (--ref == 0) delete this;`. `ref = 1;` is the first line of the constructor.
When one of the calls fails and the exception is thrown to the script, I get the above assertion failure message. This is how the exceptions are thrown to the script, followed by a `return;` from the constructor.
asGetActiveContext()->SetException("...", true);
Is this expected behavior?