Skip to content

Commit d97043c

Browse files
author
Tjaz Erzen
committed
Simplify exception handling in codeplain_REST_api.py
1 parent 41d449c commit d97043c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

codeplain_REST_api.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@
1010
MAX_RETRIES = 4
1111
RETRY_DELAY = 3
1212

13-
NO_RETRY_ERROR_CODES = ["InternalServerError"]
13+
NO_RETRY_ERROR_CODES = [
14+
"FunctionalRequirementTooComplex",
15+
"ConflictingRequirements",
16+
"CreditBalanceTooLow",
17+
"MissingResource",
18+
"PlainSyntaxError",
19+
"InternalServerError",
20+
]
1421

1522

1623
class CodeplainAPI:
@@ -74,7 +81,7 @@ def post_request(self, endpoint_url, headers, payload, run_state: Optional[RunSt
7481
response.raise_for_status()
7582
return response_json
7683

77-
except (ConnectionError, Timeout, RequestException) as e:
84+
except Exception as e:
7885
if response_json is not None and response_json["error_code"] in NO_RETRY_ERROR_CODES:
7986
raise plain2code_exceptions.InternalServerError(response_json["message"])
8087

0 commit comments

Comments
 (0)