Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging next to main for release 2.5.2 #19

Merged
merged 2 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Microsoft Teams

Publisher: Splunk
Connector Version: 2.5.1
Connector Version: 2.5.2
Product Vendor: Microsoft
Product Name: Teams
Product Version Supported (regex): ".\*"
Expand Down
4 changes: 2 additions & 2 deletions microsoftteams.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"product_version_regex": ".*",
"publisher": "Splunk",
"license": "Copyright (c) 2019-2024 Splunk Inc.",
"app_version": "2.5.1",
"utctime_updated": "2024-04-04T10:47:00.000000Z",
"app_version": "2.5.2",
"utctime_updated": "2024-04-10T10:46:03.000000Z",
"package_name": "phantom_microsoftteams",
"main_module": "microsoftteams_connector.py",
"min_phantom_version": "6.1.1",
Expand Down
10 changes: 5 additions & 5 deletions microsoftteams_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _handle_login_redirect(request, key):
return response


def _get_error_message_from_exception(self, e):
def _get_error_message_from_exception(e, app_connector):
"""
Get appropriate error message from the exception.
:param e: Exception object
Expand All @@ -71,7 +71,7 @@ def _get_error_message_from_exception(self, e):
error_code = None
error_msg = ERROR_MSG_UNAVAILABLE

self.error_print("Error occurred.", e)
app_connector.error_print("Error occurred.", e)

try:
if hasattr(e, "args"):
Expand All @@ -81,7 +81,7 @@ def _get_error_message_from_exception(self, e):
elif len(e.args) == 1:
error_msg = e.args[0]
except Exception as e:
self.error_print("Error occurred while fetching exception information. Details: {}".format(str(e)))
app_connector.error_print("Error occurred while fetching exception information. Details: {}".format(str(e)))

if not error_code:
error_text = "Error Message: {}".format(error_msg)
Expand Down Expand Up @@ -1249,14 +1249,14 @@ def finalize(self):
if self._state.get(MSTEAMS_TOKEN_STRING, {}).get(MSTEAMS_ACCESS_TOKEN_STRING):
self._state[MSTEAMS_TOKEN_STRING][MSTEAMS_ACCESS_TOKEN_STRING] = self.encrypt_state(self._access_token, "access")
except Exception as e:
self.debug_print("{}: {}".format(MSTEAMS_ENCRYPTION_ERROR, self._get_error_message_from_exception(e)))
self.debug_print("{}: {}".format(MSTEAMS_ENCRYPTION_ERROR, _get_error_message_from_exception(e, self)))
return self.set_status(phantom.APP_ERROR, MSTEAMS_ENCRYPTION_ERROR)

try:
if self._state.get(MSTEAMS_TOKEN_STRING, {}).get(MSTEAMS_REFRESH_TOKEN_STRING):
self._state[MSTEAMS_TOKEN_STRING][MSTEAMS_REFRESH_TOKEN_STRING] = self.encrypt_state(self._refresh_token, "refresh")
except Exception as e:
self.debug_print("{}: {}".format(MSTEAMS_ENCRYPTION_ERROR, self._get_error_message_from_exception(e)))
self.debug_print("{}: {}".format(MSTEAMS_ENCRYPTION_ERROR, self._get_error_message_from_exception(e, self)))
return self.set_status(phantom.APP_ERROR, MSTEAMS_ENCRYPTION_ERROR)
self._state[MSTEAMS_STATE_IS_ENCRYPTED] = True
# Save the state, this data is saved across actions and app upgrades
Expand Down
1 change: 1 addition & 0 deletions release_notes/2.5.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Fixed error message handling function
Loading