Revision: 1731 http://svn.sourceforge.net/vexi/?rev=1731&view=rev Author: mkpg2 Date: 2007-03-15 10:12:48 -0700 (Thu, 15 Mar 2007)
Log Message: ----------- Feature. Adding type to exceptions Modified Paths: -------------- core/trunk/org.ibex.js/src/org/ibex/js/Constants.java core/trunk/org.ibex.js/src/org/ibex/js/Interpreter.jpp core/trunk/org.ibex.js/src/org/ibex/js/JSExn.java core/trunk/org.ibex.js/src/org/ibex/js/XMLRPC.jpp core/trunk/org.ibex.js/src_junit/test/js/rpc/xmlrpc/no_handler.js Modified: core/trunk/org.ibex.js/src/org/ibex/js/Constants.java =================================================================== --- core/trunk/org.ibex.js/src/org/ibex/js/Constants.java 2007-03-15 09:15:16 UTC (rev 1730) +++ core/trunk/org.ibex.js/src/org/ibex/js/Constants.java 2007-03-15 17:12:48 UTC (rev 1731) @@ -26,6 +26,8 @@ static final JS SC_string = JSU.S("string",true); static final JS SC_trapee = JSU.S("trapee",true); static final JS SC_trapname = JSU.S("trapname",true); + static final JS SC_type = JSU.S("type",true); + static final JS SC_xmlrpc = JSU.S("xmlrpc",true); static final JS NC_0 = JSU.N(0); static final JS NC_1 = JSU.N(1); Modified: core/trunk/org.ibex.js/src/org/ibex/js/Interpreter.jpp =================================================================== --- core/trunk/org.ibex.js/src/org/ibex/js/Interpreter.jpp 2007-03-15 09:15:16 UTC (rev 1730) +++ core/trunk/org.ibex.js/src/org/ibex/js/Interpreter.jpp 2007-03-15 17:12:48 UTC (rev 1731) @@ -381,7 +381,7 @@ if (object == null) { method = (JS)stack.pop(); object = (JS)stack.pop(); - throw new JSExn("function '"+JSU.str(method)+"' not found in " + object.getClass().getName()); + throw new JSExn("function '"+JSU.str(method)+"' not found in " + JSU.str(object)); } else if (object == JS.METHOD) { method = (JS)stack.pop(); object = (JS)stack.pop(); @@ -414,7 +414,7 @@ if(thrown instanceof JSExn.ExnJSObj){ throw ((JSExn.ExnJSObj)thrown).getJSExn(); }else - throw new JSExn(thrown, this); + throw new JSExn(thrown, null, this); } case ADD_TRAP: case DEL_TRAP: { Modified: core/trunk/org.ibex.js/src/org/ibex/js/JSExn.java =================================================================== --- core/trunk/org.ibex.js/src/org/ibex/js/JSExn.java 2007-03-15 09:15:16 UTC (rev 1730) +++ core/trunk/org.ibex.js/src/org/ibex/js/JSExn.java 2007-03-15 17:12:48 UTC (rev 1731) @@ -18,9 +18,10 @@ private Basket.List backtrace = new Basket.Array(); private ExnJSObj js = null; public JSExn(String s) { this(JSU.S(s)); } - public JSExn(JS js) { this(js,null); } - public JSExn(JS js, Interpreter cx) { - this.js = new ExnJSObj(js); + public JSExn(JS msg) { this(msg,null); } + public JSExn(JS msg, JS type) { this(msg,type,null); } + public JSExn(JS msg, JS type, Interpreter cx) { + this.js = new ExnJSObj(msg,type); fill(cx); } @@ -80,9 +81,10 @@ // JSExn JS interface (as !JSExn instanceof JS) // Provides access to the stack trace from JSExn. public class ExnJSObj extends JS.Obj{ - public ExnJSObj(JS msg) { + public ExnJSObj(JS msg, JS type) { try{ put(SC_message,msg); + put(SC_type,type); }catch(JSExn e){ // Shouldn't happen } Modified: core/trunk/org.ibex.js/src/org/ibex/js/XMLRPC.jpp =================================================================== --- core/trunk/org.ibex.js/src/org/ibex/js/XMLRPC.jpp 2007-03-15 09:15:16 UTC (rev 1730) +++ core/trunk/org.ibex.js/src/org/ibex/js/XMLRPC.jpp 2007-03-15 17:12:48 UTC (rev 1731) @@ -356,7 +356,7 @@ try { new Helper().parse(br); if (fault) - return new JSExn(((JS)objects.get(0)).get(SC_faultString)); + return new JSExn(((JS)objects.get(0)).get(SC_faultString),SC_xmlrpc)); final JS result = (objects.size() == 0 ? (JS)null : ((JS)objects.get(0))); return result; @@ -367,7 +367,7 @@ } } catch (final IOException e) { final String msg = e.getMessage(); - return new JSExn(msg); + return new JSExn(JSU.S(msg), SC_xmlrpc); } }catch (final JSExn e) { return e; Modified: core/trunk/org.ibex.js/src_junit/test/js/rpc/xmlrpc/no_handler.js =================================================================== --- core/trunk/org.ibex.js/src_junit/test/js/rpc/xmlrpc/no_handler.js 2007-03-15 09:15:16 UTC (rev 1730) +++ core/trunk/org.ibex.js/src_junit/test/js/rpc/xmlrpc/no_handler.js 2007-03-15 17:12:48 UTC (rev 1731) @@ -7,5 +7,7 @@ assert(false); } catch(e){ + sys.print(e.type); + assert(e.type=="xmlrpc"); sys.print(e.message); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn