Skip to content

Commit

Permalink
Merge pull request #101 from nylas/incident-20231214-ews-id-is-in-ews…
Browse files Browse the repository at this point in the history
…legacyid-format-error-causing-sync-delays

incident-20231214-ews-id-is-in-ewslegacyid-format-error-causing-sync-delays
  • Loading branch information
pengfeiye authored Dec 14, 2023
2 parents a9369b2 + a380238 commit 678ddf6
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions exchangelib/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@
ErrorInternalServerTransientError, ErrorNoRespondingCASInDestinationSite, ErrorImpersonationFailed, \
ErrorMailboxMoveInProgress, ErrorAccessDenied, ErrorConnectionFailed, RateLimitError, ErrorServerBusy, \
ErrorTooManyObjectsOpened, ErrorInvalidLicense, ErrorInvalidSchemaVersionForMailboxVersion, \
ErrorInvalidServerVersion, ErrorInvalidSyncStateData, ErrorItemNotFound, ErrorADUnavailable, ResponseMessageError, ErrorInvalidChangeKey, \
ErrorInvalidServerVersion, ErrorInvalidSyncStateData, ErrorItemNotFound, ErrorADUnavailable, ResponseMessageError, \
ErrorInvalidChangeKey, \
ErrorItemSave, ErrorInvalidIdMalformed, ErrorMessageSizeExceeded, UnauthorizedError, \
ErrorCannotDeleteTaskOccurrence, ErrorMimeContentConversionFailed, ErrorRecurrenceHasNoOccurrence, \
ErrorNameResolutionMultipleResults, ErrorNameResolutionNoResults, ErrorNoPublicFolderReplicaAvailable, \
ErrorInvalidOperation, ErrorSubscriptionUnsubscribed, MalformedResponseError
ErrorInvalidOperation, ErrorSubscriptionUnsubscribed, MalformedResponseError, \
ErrorInvalidIdMalformedEwsLegacyIdFormat
from .ewsdatetime import EWSDateTime, NaiveDateTimeNotAllowed
from .transport import wrap, extra_headers
from .util import chunkify, create_element, add_xml_child, get_xml_attr, to_xml, post_ratelimited, \
Expand Down Expand Up @@ -496,12 +498,16 @@ def _get_exception(cls, code, text, msg_xml):

def _get_elements_in_response(self, response):
for msg in response:
container_or_exc = self._get_element_container(message=msg, name=self.element_container_name)
if isinstance(container_or_exc, (bool, Exception)):
yield container_or_exc
else:
for c in self._get_elements_in_container(container=container_or_exc):
yield c
try:
container_or_exc = self._get_element_container(message=msg, name=self.element_container_name)
if isinstance(container_or_exc, (bool, Exception)):
yield container_or_exc
else:
for c in self._get_elements_in_container(container=container_or_exc):
yield c
except ErrorInvalidIdMalformedEwsLegacyIdFormat as e:
log.error('Caught ErrorInvalidIdMalformedEwsLegacyIdFormat error', e=e, exc_info=True, msg=msg)
continue

@staticmethod
def _get_elements_in_container(container):
Expand Down

0 comments on commit 678ddf6

Please sign in to comment.