handle exceptions from generating native code