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
+3 -4
View File
@@ -2,8 +2,7 @@ module main
go 1.16
replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/shuffle/shuffle-shared => ../../../shuffle-shared
//replace github.com/frikky/kin-openapi => ../../../../git/kin-openapi
//replace github.com/frikky/go-elasticsearch => ../../../../git/go-elasticsearch
@@ -15,7 +14,7 @@ require (
github.com/basgys/goxml2json v1.1.0
github.com/carlescere/scheduler v0.0.0-20170109141437-ee74d2f83d82
github.com/docker/docker v20.10.12+incompatible
github.com/frikky/kin-openapi v0.41.0
github.com/frikky/kin-openapi v0.42.0
github.com/fsouza/go-dockerclient v1.7.7
github.com/ghodss/yaml v1.0.0
github.com/go-git/go-billy/v5 v5.3.1
@@ -24,7 +23,7 @@ require (
github.com/h2non/filetype v1.1.3
github.com/nirasan/go-oauth-pkce-code-verifier v0.0.0-20170819232839-0fbfe93532da // indirect
github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.2.87
github.com/shuffle/shuffle-shared v0.3.5
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
google.golang.org/api v0.65.0