Application functions and class methods registered with the script engine are allowed to throw C++ exceptions. The virtual machine will automatically catch any C++ exception, abort the script execution, and return control to the application.
The VM will however not be able to distinguish between different types of exceptions. If the application developer wish to be able to do so, it will be necessary to write and register a wrapper that catches the exceptions and translates them into a script exception.
Some applications uses longjmp to do error handling. When performing a longjmp to a previously saved state, there is no chance for the code to do a cleanup of all that happened after the saved state. Because of that the application must not register functions that can perform a longjmp out from the function, as that can leave the virtual machine in an undefined state.