1 Reply Latest reply on Dec 11, 2013 2:32 PM by Lars Burgess

    How do I handle a create error in the sync notification callback (4.0 javascript)?

      When I try code like below I receive the error TypeError: Result of expression 'Rho.RhoConnectClient.on_sync_create_error' [undefined] is not a function.

       

      What I am trying to accomplish is to have the record that could not be created on the backend be resent the next time I sync.

       

      From what I could find in the documentation, this used to be handled in the SyncEngine api in 2.2. In 4.0 the SyncEngine api was replaced with the RhoConnectClient api.

      In the RhoConnectClient api the methods on_sync_create_error, on_sync_update_error, and on_sync_delete_error do not seem to exist and I am just trying to figure out

      how to handle this situation.

       

      function syncNotify(params){

          //console.log(params);

          console.log("syncNotify " + params.source_name + " " + params.status);   

         

          if (params.server_errors){

       

              if (params.server_errors["login-error"]){

                  var login_error = params.server_errors["login-error"];

                  console.log("login error: " + JSON.stringify(login_error));

              }

              if (params.server_errors["query-error"]){

                  var query_error = params.server_errors["query-error"];

                  console.log("query error: " + JSON.stringify(query_error));   

              }

              if (params.server_errors["create-error"]){

                  var create_error = params.server_errors["create-error"];

                  console.log("create error: " + JSON.stringify(create_error));

                  for ( property in create_error ) {

                      console.log(create_error[property].message);

                  }

                  Rho.RhoConnectClient.on_sync_create_error(params.server_errors["create-error"], "recreate")

              }

              if (params.server_errors["update-error"]){

                  var update_error = params.server_errors["update-error"];

                  console.log("update error: " + JSON.stringify(update_error));

                      //Rho.RhoConnectClient.on_sync_update_error(params.server_errors["update-error"], "retry")

              }

              if (params.server_errors["delete-error"]){

                  var delete_error = params.server_errors["delete-error"];

                  console.log("delete error: " + JSON.stringify(delete_error));   

                  //Rho.RhoConnectClient.on_sync_delete_error(params.server_errors["delete-error"], "retry")

              }

              if (params.server_errors["logoff-error"]){

                  var logoff_error = params.server_errors["logoff-error"];

                  console.log("logoff error: " + JSON.stringify(logoff_error));

              }

          }

      }