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);
};
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);
};
}
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 {
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);
}
};
}