-// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
+
package org.ibex.js;
-import org.ibex.util.*;
+import org.ibex.util.*;
import java.io.*;
/** An exception which can be thrown and caught by JavaScript code */
public class JSExn extends Exception {
- private Vec backtrace = new Vec();
+ private Basket.List backtrace = new Basket.Array();
private JS js;
- public JSExn(String s) { this(JS.S(s)); }
+ public JSExn(String s) { this(JSU.S(s)); }
public JSExn(JS js) { this(js,null); }
public JSExn(JS js, Interpreter cx) { this.js = js; fill(cx); }
}
public void printStackTrace() { printStackTrace(System.err); }
public void printStackTrace(PrintWriter pw) {
- for(int i=0; i<backtrace.size(); i++) pw.println(" at " + (String) backtrace.elementAt(i));
+ for(int i=0; i<backtrace.size(); i++) pw.println(" at " + (String) backtrace.get(i));
super.printStackTrace(pw);
}
public void printStackTrace(PrintStream ps) {
- for(int i=0; i<backtrace.size(); i++) ps.println(" at " + (String) backtrace.elementAt(i));
+ for(int i=0; i<backtrace.size(); i++) ps.println(" at " + (String) backtrace.get(i));
super.printStackTrace(ps);
}
- public String toString() { return "JSExn: " + JS.debugToString(js); }
+ public String toString() { return "JSExn: " + JSU.str(js); }
public String getMessage() { return toString(); }
public JS getObject() { return js; }
- void addBacktrace(String line) { backtrace.addElement(line); }
+ void addBacktrace(String line) { backtrace.add(line); }
public static class Wrapper extends RuntimeException {
public final JSExn e;
public Wrapper(JSExn e) { this.e = e; }
- public JSExn refill() {
+ public JSExn unwrap() {
e.addBacktrace("[foreign code]");
e.fill(null);
return e;
public static class IO extends JSExn {
public IO(java.io.IOException ioe) {
super("ibex.io: " + ioe.toString());
- JS.warn(ioe);
+ JSU.warn(ioe);
}
}
}