update all endpoints

This commit is contained in:
Anthony Stirling
2025-06-02 22:49:46 +01:00
parent 02aad40aa0
commit 2ee43b2070
63 changed files with 169 additions and 136 deletions

View File

@@ -83,6 +83,11 @@ public class AutoJobAspect {
try {
return joinPoint.proceed(args);
} catch (Throwable ex) {
log.error(
"AutoJobAspect caught exception during job execution: {}",
ex.getMessage(),
ex);
// Ensure we wrap the exception but preserve the original message
throw new RuntimeException(ex);
}
});

View File

@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import stirling.software.common.annotations.AutoJobPostMapping;
import stirling.software.common.model.job.JobResult;
import stirling.software.common.model.job.JobStats;
import stirling.software.common.service.FileStorage;

View File

@@ -1,6 +1,7 @@
package stirling.software.common.service;
import java.io.IOException;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -112,7 +113,9 @@ public class JobExecutorService {
.body("Job timed out after " + effectiveTimeoutMs + " ms");
} catch (Exception e) {
log.error("Error executing synchronous job: {}", e.getMessage(), e);
return ResponseEntity.internalServerError().body("Job failed: " + e.getMessage());
// Construct a JSON error response
return ResponseEntity.internalServerError()
.body(Map.of("error", "Job failed: " + e.getMessage()));
}
}
}