Skip to content

Commit a982b84

Browse files
authored
add error handling for test case gen (#1351)
1 parent cd75f2b commit a982b84

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

13_sandboxes/test_case_generator.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,12 @@ def generate(self, file_name: str) -> str:
152152
},
153153
)
154154
output = response.choices[0].message.content
155-
output_contents = json.loads(output)["file_contents"]
156-
return self.write_outputs(f"test_{file_name}", output_contents)
155+
try:
156+
output_contents = json.loads(output)["file_contents"]
157+
return self.write_outputs(f"test_{file_name}", output_contents)
158+
except Exception as e:
159+
print(f"Error generating test file: {e}")
160+
return None
157161

158162

159163
@app.function(

0 commit comments

Comments
 (0)