We need a decorator to catch unhandled exceptions for debugging. For us to see the traceback we need it saved to the action result as in the code below. For security reasons this feature needs to be toggleable via the SOAR app.json.
@handle('test_connectivity')
def _handle_test_connectivity(self, param):
action_result = self.add_action_result(ActionResult(dict(param)))
self.save_progress("Connecting to endpoint")
# Note: There was an `auth` call when the `tdx` object was created.
# This call results in a second call to `auth`
tb = None
msg = None
try:
raise Exception("This is a test")
except Exception as ex:
msg = ex
tb = traceback.format_exc()
# success = self.tdx.auth()
action_result.add_data({"traceback": tb})
if False:
self.save_progress("Test Connectivity Passed")
return action_result.set_status(
phantom.APP_SUCCESS, "Active connection")
else:
self.save_progress("Test Connectivity Failed")
return action_result.set_status(
phantom.APP_ERROR, f"Failed connection: {msg}")
techservicesillinois/secops-soar-tdx#161
We need a decorator to catch unhandled exceptions for debugging. For us to see the traceback we need it saved to the action result as in the code below. For security reasons this feature needs to be toggleable via the SOAR app.json.
techservicesillinois/secops-soar-tdx#161