Skip to content

Commit cb775bf

Browse files
samyarpotlapallismlindauer
authored andcommitted
Raised http error for failed delete API call
1 parent af938c5 commit cb775bf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/sasctl/_services/score_execution.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,21 @@ def create_score_execution(
7777
if score_execution.status_code >= 400:
7878
raise HTTPError(
7979
{
80-
f"Something went wrong in the GET statement. See error: {score_execution.json()}"
80+
f"Something went wrong in the LIST_EXECUTIONS statement. See error: {score_execution.json()}"
8181
}
8282
)
8383

8484
# Checking the count of the execution list to see if there are any score executions for this score_definition_id already running
8585
execution_count = score_execution.get("count") # Exception catch location
8686
if execution_count == 1:
8787
execution_id = score_execution.get("items", [0], ["id"])
88-
deleted_execution = cls.delete_execution(execution_id)
88+
deleted_execution = cls.delete_execution(execution_id)
89+
if deleted_execution.status_code >= 400:
90+
raise HTTPError(
91+
{
92+
f"Something went wrong in the DELETE statement. See error: {score_execution.json()}"
93+
}
94+
)
8995

9096
headers_score_exec = {"Content-Type": "application/json"}
9197

0 commit comments

Comments
 (0)