add handling for the 'ex' object type.
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 May 2005 21:50:19 +0000 (21:50 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 9 May 2005 21:50:19 +0000 (21:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@688 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/javascript/util/RemoteRequest.js

index c1784dd..ba1377d 100644 (file)
@@ -231,18 +231,25 @@ RemoteRequest.prototype.isReady = function() {
 RemoteRequest.prototype.getResultObject = function() {
        var text = this.xmlhttp.responseText;
        var obj = JSON2js(text);
+
        if(obj == null) {
                debug("received null response");
                return null;
        }
 
-       if(obj && obj.is_err) { 
+       if(obj.is_err) { 
                debug("Something's Wrong: " + js2JSON(obj));
                throw new EXCommunication(obj.err_msg); 
        }
 
        if( obj[0] != null && obj[1] == null ) 
-               return obj[0];
+               obj = obj[0];
+
+       /* these are user level exceptions from the server code */
+       if(instanceOf(obj, ex)) {
+               debug("Received user level exception: " + obj.err_msg());
+               throw obj;
+       }
 
        return obj;
 }