Added more error message handlers to SDK

This commit is contained in:
frikky
2022-10-22 22:56:05 +02:00
parent 558b47b7dd
commit cbaf4ace92
4 changed files with 75 additions and 59 deletions
+4 -5
View File
@@ -1433,7 +1433,7 @@ class AppBase:
"execution_id": self.current_execution_id
}
self.logger.info("[DEBUG] Before FULLEXEC stream result")
self.logger.info("[ERROR] Before FULLEXEC stream result")
ret = requests.post(
"%s/api/v1/streams/results" % (self.base_url),
headers=headers,
@@ -1444,8 +1444,7 @@ class AppBase:
fullexecution = ret.json()
else:
try:
self.logger.info("[DEBUG] Error: Data: ", ret.json())
self.logger.info("[DEBUG] Error with status code for results. Crashing because ACTION_RESULTS or WORKFLOW_VARIABLE can't be handled. Status: %d" % ret.status_code)
self.logger.info("[ERROR] Error in app with status code for results. Crashing because results can't be handled. Status: %d" % ret.status_code)
except json.decoder.JSONDecodeError:
pass
@@ -1457,7 +1456,7 @@ class AppBase:
self.send_result(self.action_result, headers, stream_path)
return
except requests.exceptions.ConnectionError as e:
self.logger.info("[DEBUG] FullExec Connectionerror: %s" % e)
self.logger.info("[ERROR] FullExec Connectionerror: %s" % e)
self.action_result["result"] = json.dumps({
"success": False,
"reason": f"Connection error during startup: {e}"
@@ -1470,7 +1469,7 @@ class AppBase:
try:
fullexecution = json.loads(self.full_execution)
except json.decoder.JSONDecodeError as e:
self.logger.info("[WARNING] Json decode execution error: %s" % e)
self.logger.info("[ERROR] Json decode execution error: %s" % e)
self.action_result["result"] = "Json error during startup: %s" % e
self.send_result(self.action_result, headers, stream_path)
return