create static method
Creates a specific type of SyncError instance based on the category
and the code
supplied.
Implementation
static SyncError create(String message, SyncErrorCategory category, int code, {bool isFatal = false}) {
switch (category) {
case SyncErrorCategory.client:
final SyncClientErrorCode errorCode = SyncClientErrorCode.fromInt(code);
if (errorCode == SyncClientErrorCode.autoClientResetFailure) {
return ClientResetError(message);
}
return SyncClientError(message, category, errorCode, isFatal: isFatal);
case SyncErrorCategory.connection:
return SyncConnectionError(message, category, SyncConnectionErrorCode.fromInt(code), isFatal: isFatal);
case SyncErrorCategory.session:
return SyncSessionError(message, category, SyncSessionErrorCode.fromInt(code), isFatal: isFatal);
case SyncErrorCategory.resolve:
return SyncResolveError(message, category, SyncResolveErrorCode.fromInt(code));
case SyncErrorCategory.system:
case SyncErrorCategory.unknown:
default:
return GeneralSyncError(message, category, code);
}
}