[open-ils-commits] r19986 - trunk/Open-ILS/web/js/dojo/openils (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Apr 5 13:06:12 EDT 2011
Author: miker
Date: 2011-04-05 13:06:09 -0400 (Tue, 05 Apr 2011)
New Revision: 19986
Modified:
trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js
Log:
improve the ability of PermaCrud callers to deal with errors not of the ils_event shape
Modified: trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js 2011-04-05 03:24:29 UTC (rev 19985)
+++ trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js 2011-04-05 17:06:09 UTC (rev 19986)
@@ -271,7 +271,8 @@
params : [ _pcrud.auth() ],
onerror : function (r) {
_pcrud.disconnect();
- throw 'Transaction commit error';
+ if (req._final_error) req._final_error(r)
+ else throw 'Transaction commit error';
},
oncomplete : function (r) {
var res = r.recv();
@@ -281,20 +282,22 @@
_pcrud.disconnect();
} else {
_pcrud.disconnect();
- throw 'Transaction commit error';
+ if (req._final_error) req._final_error(r)
+ else throw 'Transaction commit error';
}
},
}).send();
} else {
_pcrud.disconnect();
- throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
+ if (req._final_error) req._final_error(r)
+ else throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
}
};
req.onerror = function (r) {
+ _pcrud.disconnect();
if (r._final_error) r._final_error(r);
- _pcrud.disconnect();
- throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
+ else throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
};
} else {
@@ -307,12 +310,13 @@
_CUD_recursive( r._obj_list, r._pos, r._final_complete );
} else {
_pcrud.disconnect();
- throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
+ if (r._final_error) r._final_error(r);
+ else throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
}
};
req.onerror = function (r) {
+ _pcrud.disconnect();
if (r._final_error) r._final_error(r);
- _pcrud.disconnect();
throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
};
}
More information about the open-ils-commits
mailing list