fix: prevent S3 upload failures from crashing the entire execution result save
This commit is contained in:
parent
ba5a67905e
commit
bc31a69621
|
|
@ -416,18 +416,22 @@ public class AgentService {
|
|||
|
||||
String base64 = (String) stepData.get("screenshotBase64");
|
||||
if (base64 != null && !base64.isEmpty()) {
|
||||
byte[] imageBytes = java.util.Base64.getDecoder().decode(base64);
|
||||
String fileName = "exec_" + executionId + "_step_" + sr.getId() + "_" + System.currentTimeMillis() + ".png";
|
||||
try {
|
||||
byte[] imageBytes = java.util.Base64.getDecoder().decode(base64);
|
||||
String fileName = "exec_" + executionId + "_step_" + sr.getId() + "_" + System.currentTimeMillis() + ".png";
|
||||
|
||||
String s3Url = s3Service.uploadImage(fileName, imageBytes);
|
||||
String s3Url = s3Service.uploadImage(fileName, imageBytes);
|
||||
|
||||
Screenshot sc = new Screenshot();
|
||||
sc.setExecutionId(executionId);
|
||||
sc.setStepResultId(sr.getId());
|
||||
sc.setFileName(fileName);
|
||||
sc.setContentType("image/png");
|
||||
sc.setStoragePath(s3Url);
|
||||
screenshotRepository.save(sc);
|
||||
Screenshot sc = new Screenshot();
|
||||
sc.setExecutionId(executionId);
|
||||
sc.setStepResultId(sr.getId());
|
||||
sc.setFileName(fileName);
|
||||
sc.setContentType("image/png");
|
||||
sc.setStoragePath(s3Url);
|
||||
screenshotRepository.save(sc);
|
||||
} catch (Exception ex) {
|
||||
System.err.println("Failed to upload screenshot to S3: " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue