capture osrfServerError responses
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 2 Apr 2009 19:59:49 +0000 (19:59 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Thu, 2 Apr 2009 19:59:49 +0000 (19:59 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1691 9efc2488-bf62-4759-914b-345cdb29e865

src/javascript/opensrf.js

index 8e67234..5675cbd 100644 (file)
@@ -270,7 +270,7 @@ OpenSRF.Stack.handle_message = function(ses, osrf_msg, callbacks) {
             }
         }
 
-        if(status == OSRF_STATUS_NOTFOUND) {
+        if(status == OSRF_STATUS_NOTFOUND || status == OSRF_STATUS_INTERNALSERVERERROR) {
             req = ses.find_request(osrf_msg.threadTrace());
             if(callbacks.onmethoderror) 
                 return callbacks.onmethoderror(req, status, status_text);
@@ -398,6 +398,19 @@ osrfResult.prototype.content = function() {
         this.hash.content = d; 
     return this.hash.content; 
 }
-
+function osrfServerError(hash) { 
+    this.hash = hash;
+    this._encodehash = true;
+}
+osrfServerError.prototype.status = function() {
+    if(arguments.length == 1) 
+        this.hash.status = d; 
+    return this.hash.status; 
+}
+osrfServerError.prototype.statusCode = function() {
+    if(arguments.length == 1) 
+        this.hash.statusCode = d; 
+    return this.hash.statusCode; 
+}