2cc959156121a0eeaeed1684ab06ba8849c82a36
[org.ibex.core.git] / src / org / xwt / js / JSExn.java
1 // Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL] 
2 package org.xwt.js; 
3
4 import org.xwt.util.*; 
5 import org.xwt.*; 
6 import java.io.*;
7 import java.util.*;
8
9 /** An exception which can be thrown and caught by JavaScript code */
10 public class JSExn extends Exception { 
11     private Object js = null; 
12     public JSExn(Object js) { this.js = js; } 
13     public String toString() { return "JSExn: " + js; }
14     public String getMessage() { return toString(); }
15     public Object getObject() { return js; } 
16
17
18 /** should only be used for failed coercions */
19 class JSRuntimeExn extends RuntimeException {
20     private Object js = null; 
21     public JSRuntimeExn(Object js) { this.js = js; } 
22     public String toString() { return "JSRuntimeExn: " + js; }
23     public String getMessage() { return toString(); }
24     public Object getObject() { return js; } 
25 }
26