LP#1268619: JS libs capture all method errors
authorBill Erickson <berick@esilibrary.com>
Tue, 8 Jul 2014 13:41:12 +0000 (09:41 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Tue, 19 Aug 2014 22:54:47 +0000 (15:54 -0700)
Instead of selecting specific errors to report as method errors, report
all API calls which return 400 or 500-series errors as method errors.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

src/javascript/opensrf.js

index 8036c5a..a31c550 100644 (file)
@@ -632,7 +632,8 @@ OpenSRF.Stack.handle_message = function(ses, osrf_msg) {
             }
         }
 
-        if(status == OSRF_STATUS_NOTFOUND || status == OSRF_STATUS_INTERNALSERVERERROR) {
+        // capture all 400's and 500's as method errors
+        if (status.match(/^4/) || status.match(/^5/)) {
             if(req && req.onmethoderror) 
                 return req.onmethoderror(req, status, status_text);
         }