Wrap ensureDir in try-catch blocks

This commit is contained in:
mikiher 2025-12-01 18:00:34 +02:00
parent 329e3c7179
commit 5f1edcb609
5 changed files with 67 additions and 22 deletions

View file

@ -459,7 +459,12 @@ class PlaybackSessionManager {
* Remove all stream folders in `/metadata/streams`
*/
async removeOrphanStreams() {
await fs.ensureDir(this.StreamsPath)
try {
await fs.ensureDir(this.StreamsPath)
} catch (error) {
Logger.error(`[PlaybackSessionManager] Failed to create streams directory at "${this.StreamsPath}": ${error.message}`)
throw new Error(`[PlaybackSessionManager] Failed to create streams directory at "${this.StreamsPath}"`, { cause: error })
}
try {
const streamsInPath = await fs.readdir(this.StreamsPath)
for (const streamId of streamsInPath) {