internal void Handle(CloudTable table, StorageException exception) { if (exception.RequestInformation.HttpStatusCode == (int)HttpStatusCode.Conflict) { throw ConcurrencyConflictException.StreamChangedOrExists(partition); } throw exception.PreserveStackTrace(); }
internal void Handle(CloudTable table, StorageException exception) { if (exception.RequestInformation.HttpStatusCode == (int)HttpStatusCode.PreconditionFailed) { throw ConcurrencyConflictException.StreamChangedOrExists(partition); } if (exception.RequestInformation.HttpStatusCode != (int)HttpStatusCode.Conflict) { throw exception.PreserveStackTrace(); } var error = exception.RequestInformation.ExtendedErrorInformation; if (error.ErrorCode != "EntityAlreadyExists") { throw UnexpectedStorageResponseException.ErrorCodeShouldBeEntityAlreadyExists(error); } var position = ParseConflictingEntityPosition(error); Debug.Assert(position >= 0 && position < operations.Count); var conflicting = operations[position].Entity; if (conflicting == stream) { throw ConcurrencyConflictException.StreamChangedOrExists(partition); } var id = conflicting as EventIdEntity; if (id != null) { throw new DuplicateEventException(partition, id.Event.Id); } var @event = conflicting as EventEntity; if (@event != null) { throw ConcurrencyConflictException.EventVersionExists(partition, @event.Version); } var include = operations.Single(x => x.Entity == conflicting); throw IncludedOperationConflictException.Create(partition, include); }