From: Ken A. <kan...@bb...> - 2004-08-26 21:13:47
|
jscheme.JS.eval() and probably any other method will throw a jsint.BacktraceException when a error occurs. This exception will print a backtrace of the Scheme stack, as well as the Java stack, if BacktraceException.printJavaTrace == true. So you may want to write a version of eval() that returns an Object or an Exception, and check for it. In the example below (i haven't compiled this) eval1() returns the backtraceException, and eval2() returns the underlying java exception. public class myeval { /** Return an Object a Backtrace Exception. **/ public Object eval1(String x) { try { return jscheme.JS.eval(x); } catch (Throwable e) { return e; } } /** Return an Object or the underlying Exception. **/ public Object eval2(String x) { try { return jscheme.JS.eval(x); } catch (Throwable e) { return jsint.Procedure.stripExceptionWrapper(e); } } } Please go to http://jscheme.sourceforge.net and join the mailing list! k At 11:10 AM 8/25/2004 -0700, Peter Norvig wrote: >Can you guys give him an answer? > >Thanks, >-Peter > > >---------- Forwarded message ---------- >From: Joseph Toman <jj...@ed...> >Date: Wed, 25 Aug 2004 10:53:01 -0700 >Subject: JScheme error handling? >To: pe...@no... > > >Hello, > >I'm trying to use JScheme to glue a JVM onto a C++ application (a bad >hack I have to live with). I can't >seem to find a clear explanation of what jscheme.JS.eval returns when >it's fed undefined variables, unbalanced >parens, i.e. garbage. I've looked in both the API documentation and >the code itself. Can you give me a pointer to where to >look? Is it a SchemeException similar to what you would get from >running jscheme.REPL at the command line and >feeding it garbage? Thanks for any help you can give. > > Joseph Toman |