[open-ils-commits] r19987 - trunk/Open-ILS/web/js/dojo/openils (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Apr 5 15:59:49 EDT 2011
Author: miker
Date: 2011-04-05 15:59:44 -0400 (Tue, 05 Apr 2011)
New Revision: 19987
Modified:
trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js
Log:
More PermaCrud error handling cleanup
Modified: trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js 2011-04-05 17:06:09 UTC (rev 19986)
+++ trunk/Open-ILS/web/js/dojo/openils/PermaCrud.js 2011-04-05 19:59:44 UTC (rev 19987)
@@ -296,7 +296,7 @@
req.onerror = function (r) {
_pcrud.disconnect();
- if (r._final_error) r._final_error(r);
+ if (req._final_error) req._final_error(r);
else throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
};
@@ -307,16 +307,16 @@
var res = r.recv();
if ( res && res.content() ) {
_return_list.push( res.content() );
- _CUD_recursive( r._obj_list, r._pos, r._final_complete );
+ _CUD_recursive( r._obj_list, r._pos, req._final_complete, req._final_error );
} else {
_pcrud.disconnect();
- if (r._final_error) r._final_error(r);
+ 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);
+ if (req._final_error) req._final_error(r);
throw '_CUD: Error creating, deleting or updating ' + js2JSON(obj);
};
}
@@ -435,20 +435,21 @@
oncomplete : function (r) {
var res = r.recv();
if ( res && res.content() ) {
- if (r._final_complete)
+ if (req._final_complete)
req._final_complete(req, _return_list);
_pcrud.disconnect();
} else {
_pcrud.disconnect();
- throw 'Transaction commit error';
+ if (req._final_error) req._final_error(r);
+ else throw 'Transaction commit error';
}
},
}).send();
};
req.onerror = function (r) {
- if (r._final_error) r._final_error(r);
_pcrud.disconnect();
+ if (req._final_error) req._final_error(r);
};
} else {
@@ -457,10 +458,11 @@
req.oncomplete = function (r) {
var res = r.recv();
if ( res && res.content() ) {
- _auto_CUD_recursive( r._obj_list, r._pos, r._final_complete, r._final_error );
+ _auto_CUD_recursive( r._obj_list, r._pos, req._final_complete, req._final_error );
} else {
_pcrud.disconnect();
- throw '_auto_CUD: Error creating, deleting or updating ' + js2JSON(obj);
+ if (req._final_error) req._final_error(r);
+ else throw '_auto_CUD: Error creating, deleting or updating ' + js2JSON(obj);
}
};
}
More information about the open-ils-commits
mailing list