javascript: replace exceptions with SWIG_exit

When building SWIG for Android, there is no support for C++ exceptions.

In the cases there is "Illegal state", it seems more like an internal
error, so we can replace the throw calls with a debug print and exit
immediately.

Bug: 162801433
Change-Id: I8096656f5a9f333ac2f4704438116ac8621b8193
1 file changed