The client libraries or MySQLSync throw checked exceptions upon error conditions which may occur during a synchronization call.
Base exception
The base super class of all the exceptions thrown by MySQLSync is MySQLSyncException.
Example code handling of the base exception :
try {
client.sync();
} catch (com.mysqlsync.client.MySQLSyncException e) {
System.out.println(e.getMessage());
System.out.println(e.getErrorCode()); // error code
System.out.println(e.isRetriable()); // can we retry the sync call
}
Exception subclasses
Several exceptions derive from the base MySQLSyncException class.
Network error
The exception class that indicates network failure is MSSNetworkException. Example conditions that will result in the client library throwing this exception are:
- DNS failure
- Socket timeout
- No internet
- 503 with no response body
The specific error cause can be observed through the getErrorCode() / ErrorCode / property method and based on it a decision can be made can the synchronization be retried after a while.
Data Error or Conflict
The exception class that indicates data sync conflict is MSSSyncDataException.
This is not a network error. It’s a domain-level conflict. This error is not Retryable. ❌ It requires resolution.