From 3f3b1e4cad13e7fb74cd330dd1d5a93ecb41230c Mon Sep 17 00:00:00 2001 From: Alistair Delva Date: Wed, 5 Aug 2020 10:28:09 -0700 Subject: 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 --- Source/Modules/javascript.cxx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Modules/javascript.cxx b/Source/Modules/javascript.cxx index d2b33b1b4..31576bd93 100644 --- a/Source/Modules/javascript.cxx +++ b/Source/Modules/javascript.cxx @@ -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); -- cgit v1.2.3