Skip to content

Commit 479b2da

Browse files
top level error values
1 parent ca4a194 commit 479b2da

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

codeflash/errors/errors.py

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,38 @@
1111
"BEHAVIORAL_TEST_FAILURE_ERROR", "Failed to establish a baseline for the original code - bevhavioral tests failed."
1212
)
1313

14+
_COVERAGE_THRESHOLD_NOT_MET_ERROR = CodeflashError(
15+
"COVERAGE_THRESHOLD_NOT_MET_ERROR", "The threshold for test coverage was not met."
16+
)
17+
18+
_FUNCTION_OPTIMIZATION_ATTEMPTED_ERROR = CodeflashError(
19+
"FUNCTION_OPTIMIZATION_ATTEMPTED_ERROR", "Function optimization previously attempted, skipping."
20+
)
21+
22+
_TEST_RESULT_DIDNT_MATCH_ERROR = CodeflashError(
23+
"TEST_RESULT_DIDNT_MATCH_ERROR", "Test results did not match the test results of the original code."
24+
)
25+
26+
27+
def test_result_didnt_match_error() -> CodeflashError:
28+
return _TEST_RESULT_DIDNT_MATCH_ERROR
29+
30+
31+
def function_optimization_attempted_error() -> CodeflashError:
32+
return _FUNCTION_OPTIMIZATION_ATTEMPTED_ERROR
33+
34+
35+
def coverage_threshold_not_met_error() -> CodeflashError:
36+
return _COVERAGE_THRESHOLD_NOT_MET_ERROR
37+
38+
39+
def test_confidence_threshold_not_met_error() -> CodeflashError:
40+
return _TEST_CONFIDENCE_ERROR
41+
42+
43+
def behavioral_test_failure_error() -> CodeflashError:
44+
return _BEHAVIORAL_TEST_FAILURE_ERROR
45+
1446

1547
def shell_rc_permission_error(shell_rc_path: str, api_key_line: str) -> CodeflashError:
1648
return CodeflashError(
@@ -31,18 +63,6 @@ def shell_rc_not_found_error(shell_rc_path: str, api_key_line: str) -> Codeflash
3163
)
3264

3365

34-
def test_result_didnt_match_error() -> CodeflashError:
35-
return CodeflashError(
36-
"TEST_RESULT_DIDNT_MATCH_ERROR", "Test results did not match the test results of the original code."
37-
)
38-
39-
40-
def function_optimization_attempted_error() -> CodeflashError:
41-
return CodeflashError(
42-
"FUNCTION_OPTIMIZATION_ATTEMPTED_ERROR", "Function optimization previously attempted, skipping."
43-
)
44-
45-
4666
def baseline_establishment_failed_error(failure_msg: str) -> CodeflashError:
4767
return CodeflashError(
4868
"BASELINE_ESTABLISHMENT_FAILED_ERROR",
@@ -71,15 +91,3 @@ def code_context_extraction_failed_error(error: str) -> CodeflashError:
7191
return CodeflashError(
7292
"CODE_CONTEXT_EXTRACTION_FAILED_ERROR", "Failed to extract code context. Error: {error}.", **locals()
7393
)
74-
75-
76-
def coverage_threshold_not_met_error() -> CodeflashError:
77-
return CodeflashError("COVERAGE_THRESHOLD_NOT_MET_ERROR", "The threshold for test coverage was not met.")
78-
79-
80-
def test_confidence_threshold_not_met_error() -> CodeflashError:
81-
return _TEST_CONFIDENCE_ERROR
82-
83-
84-
def behavioral_test_failure_error() -> CodeflashError:
85-
return _BEHAVIORAL_TEST_FAILURE_ERROR

0 commit comments

Comments
 (0)