private Trap() { }
public Object perform() throws JS.Exn {
- if (f.getNumFormalArgs() > 0) return cascade();
- return f.call(new TrapArgs(this));
+ try {
+ if (f.getNumFormalArgs() > 0) return cascade();
+ return f.call(new TrapArgs(this));
+ } catch (Exception e) {
+ Log.log(this, "Exception thrown from within trap: " + e);
+ return null;
+ }
}
public void perform(Object val) throws JS.Exn {
- if (f.getNumFormalArgs() == 0) cascade(val);
- TrapArgs ta = new TrapArgs(this, val);
- Object ret = f.call(ta);
- if (ret != Boolean.FALSE && !ta.cascadeHappened) cascade(val);
+ try {
+ if (f.getNumFormalArgs() == 0) cascade(val);
+ TrapArgs ta = new TrapArgs(this, val);
+ Object ret = f.call(ta);
+ if (ret != Boolean.FALSE && !ta.cascadeHappened) cascade(val);
+ } catch (Exception e) {
+ Log.log(this, "Exception thrown from within trap: " + e);
+ }
}
public Object cascade() {