Closed jsflax closed 5 years ago
The user's error delegate would receive these errors:
func on(error: DataSynchronizerError, forDocumentId documentId: BSONValue?) {
switch error {
case .decodingError(_):
// if I receive this error, the message will contain information
// telling me that I've messed with a documents version info to the point
// that it can no longer be read or decoded.
// So if that happens, I could fix the error, and then unpause
// the document.
break
case .unsupportedProtocolVersion(_):
// if I receive this error, the message will contain information
// telling me that I'm using an unsupported protocol version.
break
case .documentDoesNotExist(_):
// if I receive this error, chances are I've done something in my
// own application that is racy.
break
case .mongoDBError(_, _):
// if I receive this error, there will be more information within the
// secondary error as to what I've done
break
case .resolutionError(_):
// if I received this error, I would look to my conflict
// resolver to see what error could be surfacing here
break
case .fatalError(let msg):
// This error tells me that we've met with a terrible fate.
// The user is likely trying to use the application on a system
// that embedded mongo does not support.
fatalError(msg.localizedDescription)
}
}
It's generally so the user could debug. Documents that have been paused will not be synced on. So a user would have to fix their issues, and then unpause the document manually, which we expose methods for.
…ble errors