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.

Closes #1858
This commit is contained in:
Alistair Delva 2020-08-05 10:28:09 -07:00
parent 46e17f1458
commit 4d844a8dc2
1 changed files with 4 additions and 2 deletions

View File

@ -1575,7 +1575,8 @@ void JSCEmitter::marshalInputArgs(Node *n, ParmList *parms, Wrapper *wrapper, Ma
Printf(arg, "argv[%d]", i);
break;
default:
throw "Illegal state.";
Printf(stdout, "Illegal state.");
SWIG_exit(EXIT_FAILURE);
}
tm = emitInputTypemap(n, p, wrapper, arg);
Delete(arg);
@ -2212,7 +2213,8 @@ void V8Emitter::marshalInputArgs(Node *n, ParmList *parms, Wrapper *wrapper, Mar
Printf(arg, "args[%d]", i);
break;
default:
throw "Illegal state.";
Printf(stdout, "Illegal state.");
SWIG_exit(EXIT_FAILURE);
}
tm = emitInputTypemap(n, p, wrapper, arg);