Advanced Replication Guide : Using advanced replication with applications : Validating Intelligent Transactions : Error handling in the application
  
Error handling in the application
Because the synchronization of databases is done by the application, the error handling must also be implemented in the application, that is, in the stored procedures. Transactions can generate errors that appear either at the system or at the application level. The system level errors are typically fatal; that is, they cannot be recovered automatically.
Application level error occurs when the original behavior of the transaction is no longer valid. Typically this occurs when a conflict is detected. For instance, an order is inserted for a customer who no longer exists in the master database.
There are numerous options on how to recover from this kind of error:
Resolve the error automatically inside the transaction using a conflict resolution rule, such as "the current master version wins."
Leave the resolution of the error to the user or system administrator. An error log table can be used for storing sufficient information about the error.
Combinations of the above options — for example, resolve the conflict automatically but inform a user about the resolution using an error log table.
The method to use depends on the application and its requirements.
See also
Validating Intelligent Transactions