Prechádzať zdrojové kódy

proper error handling when a mapper maps onto a non-existing attribute

Simon Van Mierlo 8 rokov pred
rodič
commit
5c31537125
1 zmenil súbory, kde vykonal 10 pridanie a 3 odobranie
  1. 10 3
      csworker.js

+ 10 - 3
csworker.js

@@ -832,9 +832,16 @@ with AToMPM.  If not, see <http://www.gnu.org/licenses/>.
 									 var changes = {};
 	 								 for( var fullattr in attrVals )
 	 									 changes[fullattr] = attrVals[fullattr];
-									 changelogs.push(
-											 _mmmk.update(id,changes)['changelog'] );
-	 								 callback( _utils.flatten(changelogs) );
+                                     var result = _mmmk.update(id,changes);
+                                     if ( '$err' in result )
+                                         callback( 
+                                            [{'op':'SYSOUT',
+                                              'text':'ERROR :: '+result['$err']}]);
+                                     else {
+                                         changelogs.push(
+                                                 result['changelog'] );
+                                         callback( _utils.flatten(changelogs) );
+                                     }
 								 }
  							 },
 						 failuref =