fix(exceptions): catch specific error instead of broad

This commit is contained in:
2026-07-01 21:36:50 +01:00
parent a330471bec
commit 913c5c8790
3 changed files with 3 additions and 32 deletions

View File

@@ -16,6 +16,7 @@ import java.nio.file.Path;
import java.time.Duration;
import java.time.Instant;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@@ -214,7 +215,7 @@ public class MediaService {
return segMs < endMs && (segMs + HLS_SEGMENT_LENGTH * 1000) > startMs;
})
.sorted(Comparator.comparingLong(this::parseTimestampMs))
.toList();
.collect(Collectors.toList());
}
}

View File

@@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -76,13 +75,9 @@ public class StreamActionsService {
progressTracker.markComplete();
return CompletableFuture.completedFuture(outputFile);
} catch (IOException e) {
} catch (Exception e) {
logger.error("Failed to save section to '{}'", outputFile, e);
return CompletableFuture.failedFuture(e);
} catch (InterruptedException e) {
logger.error("Failed to save section");
Thread.currentThread().interrupt();
return CompletableFuture.failedFuture(e);
}
}
}