Subj : Re: Rhino: Try/Catch problem To : Edwin S. Ramirez From : Igor Bukanov Date : Fri May 14 2004 08:28 pm Edwin S. Ramirez wrote: > I tried Rhino 1.5R5 and the exception is still not caught by the > try/catch block. > When I run the code below, the exception contains a complete stack trace > from the outer > java code. > -ESR- When I run java -jar js.jar test.js where js.jar is Rhino 1.5R5 and test.js contains: function crash(b) { var a, str, num; a = b['x']; // NOT caught str = 'x'; a = b[str]; // NOT caught //a = b[1]; // caught, ok //num = 1; a = b[num]; // caught, ok //a = b.x; // caught, ok } function testcatch() { try { crash(null); writeln('no error'); } catch (e) { writeln('exception caught: '+e); } } testcatch() function writeln(s) { java.lang.System.out.println(s); } it prints: exception caught: TypeError: Cannot read property "x" from null Moreover, js.jar from 1.5R1 also catches the exception and prints: exception caught: TypeError: Cannot convert null to an object. So it must be a problem with your embedding or even JVM. Regards, Igor .