Skip to content

Commit ad9a85c

Browse files
dorschwContent Bot
andauthored
EWSv2, EWSo365: Skip-on-error skips all exceptions (#37201)
* improve skip-log * pc * RN * improve comment * undo formatting * Bump pack from version MicrosoftExchangeOnline to 1.5.17. * Bump pack from version MicrosoftExchangeOnline to 1.5.18. * fix RN --------- Co-authored-by: Content Bot <[email protected]>
1 parent ffa8880 commit ad9a85c

File tree

6 files changed

+36
-22
lines changed

6 files changed

+36
-22
lines changed

Packs/MicrosoftExchangeOnPremise/Integrations/EWSv2/EWSv2.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,16 +1332,17 @@ def fetch_emails_as_incidents(account_email, folder_name, skip_unparsable_emails
13321332

13331333
if len(incidents) >= MAX_FETCH:
13341334
break
1335-
except (UnicodeEncodeError, UnicodeDecodeError, IndexError) as e:
1336-
if skip_unparsable_emails:
1337-
error_msg = (
1338-
"Encountered email parsing issue while fetching. "
1339-
f"Skipping item with message id: {item.message_id if item.message_id else ''}"
1340-
)
1341-
demisto.debug(error_msg + f", Error: {str(e)}")
1342-
demisto.updateModuleHealth(error_msg, is_error=False)
1343-
else:
1344-
raise e
1335+
except Exception as e:
1336+
if not skip_unparsable_emails: # default is to raise and exception and fail the command
1337+
raise
1338+
1339+
# when the skip param is `True`, we log the exceptions and move on instead of failing the whole fetch
1340+
error_msg = (
1341+
"Encountered email parsing issue while fetching. "
1342+
f"Skipping item with message id: {item.message_id or '<error parsing message_id>'}"
1343+
)
1344+
demisto.debug(f"{error_msg}, Error: {str(e)} {traceback.format_exc()}")
1345+
demisto.updateModuleHealth(error_msg, is_error=False)
13451346

13461347
demisto.debug(f'EWS V2 - ending fetch - got {len(incidents)} incidents.')
13471348
last_fetch_time = last_run.get(LAST_RUN_TIME)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### EWS v2
5+
6+
Extended the `Skip Unparsable Emails` parameter to handle additional error cases.

Packs/MicrosoftExchangeOnPremise/pack_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Microsoft Exchange On-Premise",
33
"description": "Exchange Web Services",
44
"support": "xsoar",
5-
"currentVersion": "2.1.16",
5+
"currentVersion": "2.1.17",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Packs/MicrosoftExchangeOnline/Integrations/EWSO365/EWSO365.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,16 +2470,17 @@ def fetch_emails_as_incidents(client: EWSClient, last_run, incident_filter, skip
24702470

24712471
if len(incidents) >= client.max_fetch:
24722472
break
2473-
except (UnicodeEncodeError, UnicodeDecodeError, IndexError) as e:
2474-
if skip_unparsable_emails:
2475-
error_msg = (
2476-
"Encountered email parsing issue while fetching. "
2477-
f"Skipping item with message id: {item.message_id if item.message_id else ''}"
2478-
)
2479-
demisto.debug(error_msg + f", Error: {str(e)}")
2480-
demisto.updateModuleHealth(error_msg, is_error=False)
2481-
else:
2482-
raise e
2473+
except Exception as e:
2474+
if not skip_unparsable_emails: # default is to raise and exception and fail the command
2475+
raise
2476+
2477+
# when the skip param is `True`, we log the exceptions and move on instead of failing the whole fetch
2478+
error_msg = (
2479+
"Encountered email parsing issue while fetching. "
2480+
f"Skipping item with message id: {item.message_id or '<error parsing message_id>'}"
2481+
)
2482+
demisto.debug(f"{error_msg}, Error: {str(e)} {traceback.format_exc()}")
2483+
demisto.updateModuleHealth(error_msg, is_error=False)
24832484

24842485
demisto.debug(f'{APP_NAME} - ending fetch - got {len(incidents)} incidents.')
24852486

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### EWS O365
5+
6+
Extended the `Skip Unparsable Emails` parameter to handle additional error cases.

Packs/MicrosoftExchangeOnline/pack_metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Microsoft Exchange Online",
33
"description": "Exchange Online and Office 365 (mail)",
44
"support": "xsoar",
5-
"currentVersion": "1.5.21",
5+
"currentVersion": "1.5.22",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

0 commit comments

Comments
 (0)