private static T WrapException <T>(Func <T> function, Func <ConnectionsTransientException, MailboxReplicationTransientException> wrapTransientException, Func <ConnectionsPermanentException, MailboxReplicationPermanentException> wrapPermanentException) where T : class { T result = default(T); EasConnectionWrapper.WrapException(delegate() { result = function(); }, wrapTransientException, wrapPermanentException); return(result); }
private SyncResponse SyncCreation(string itemId, SyncRequest syncRequest) { SyncResponse response = this.Sync(syncRequest); SyncStatus status = response.GetAddResponseStatus(0); EasConnectionWrapper.WrapException(delegate() { response.ThrowIfStatusIsFailed(status); }, (ConnectionsTransientException e) => new EasSyncFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasSyncFailedPermanentException(e.Message, e)); return(response); }
internal Properties FetchMessageItem(string messageId, string folderId) { ItemOperationsRequest itemOperationsRequest = EasRequestGenerator.CreateItemOpsRequest(messageId, folderId); ItemOperationsResponse response = this.ItemOperations(itemOperationsRequest); ItemOperationsStatus status; Properties messageProperties = response.GetMessageProperties(0, out status); EasConnectionWrapper.WrapException(delegate() { response.ThrowIfStatusIsFailed(status); }, (ConnectionsTransientException e) => new EasFetchFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasFetchFailedPermanentException(e.Message, e)); return(messageProperties); }
private void SyncUpdate(string messageId, SyncRequest syncRequest) { SyncResponse response = this.Sync(syncRequest); SyncStatus status = response.GetChangeResponseStatus(0); if (status == SyncStatus.SyncItemNotFound) { MrsTracer.Provider.Warning("Source message {0} doesn't exist", new object[] { messageId }); throw new EasObjectNotFoundException(messageId); } EasConnectionWrapper.WrapException(delegate() { response.ThrowIfStatusIsFailed(status); }, (ConnectionsTransientException e) => new EasSyncFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasSyncFailedPermanentException(e.Message, e)); }
private SyncResponse Sync(SyncRequest syncRequest) { return(EasConnectionWrapper.WrapException <SyncResponse>(() => this.wrappedObject.Sync(syncRequest), (ConnectionsTransientException e) => new EasSyncFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasSyncFailedPermanentException(e.Message, e))); }
private SendMailResponse SendMail(SendMailRequest sendMailRequest) { return(EasConnectionWrapper.WrapException <SendMailResponse>(() => this.wrappedObject.SendMail(sendMailRequest), (ConnectionsTransientException e) => new EasSendFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasSendFailedPermanentException(e.Message, e))); }
private MoveItemsResponse MoveItems(MoveItemsRequest moveItemsRequest) { return(EasConnectionWrapper.WrapException <MoveItemsResponse>(() => this.wrappedObject.MoveItems(moveItemsRequest), (ConnectionsTransientException e) => new EasMoveFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasMoveFailedPermanentException(e.Message, e))); }
private ItemOperationsResponse ItemOperations(ItemOperationsRequest itemOperationsRequest) { return(EasConnectionWrapper.WrapException <ItemOperationsResponse>(() => this.wrappedObject.ItemOperations(itemOperationsRequest), (ConnectionsTransientException e) => new EasFetchFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasFetchFailedPermanentException(e.Message, e))); }
private GetItemEstimateResponse GetItemEstimate(GetItemEstimateRequest getItemEstimateRequest) { return(EasConnectionWrapper.WrapException <GetItemEstimateResponse>(() => this.wrappedObject.GetItemEstimate(getItemEstimateRequest), (ConnectionsTransientException e) => new EasCountFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasCountFailedPermanentException(e.Message, e))); }
private FolderUpdateResponse FolderUpdate(FolderUpdateRequest folderUpdateRequest) { return(EasConnectionWrapper.WrapException <FolderUpdateResponse>(() => this.wrappedObject.FolderUpdate(folderUpdateRequest), (ConnectionsTransientException e) => new EasFolderUpdateFailedTransientException(e.Message, e), (ConnectionsPermanentException e) => new EasFolderUpdateFailedPermanentException(e.Message, e))); }