fix: prevent S3 upload failures from crashing the entire execution result save

This commit is contained in:
vithobaa 2026-06-30 09:42:18 +05:30
parent ba5a67905e
commit bc31a69621
1 changed files with 14 additions and 10 deletions

View File

@ -416,6 +416,7 @@ public class AgentService {
String base64 = (String) stepData.get("screenshotBase64"); String base64 = (String) stepData.get("screenshotBase64");
if (base64 != null && !base64.isEmpty()) { if (base64 != null && !base64.isEmpty()) {
try {
byte[] imageBytes = java.util.Base64.getDecoder().decode(base64); byte[] imageBytes = java.util.Base64.getDecoder().decode(base64);
String fileName = "exec_" + executionId + "_step_" + sr.getId() + "_" + System.currentTimeMillis() + ".png"; String fileName = "exec_" + executionId + "_step_" + sr.getId() + "_" + System.currentTimeMillis() + ".png";
@ -428,6 +429,9 @@ public class AgentService {
sc.setContentType("image/png"); sc.setContentType("image/png");
sc.setStoragePath(s3Url); sc.setStoragePath(s3Url);
screenshotRepository.save(sc); screenshotRepository.save(sc);
} catch (Exception ex) {
System.err.println("Failed to upload screenshot to S3: " + ex.getMessage());
}
} }
} }
} }