mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-22 11:49:37 +00:00
Wrap ensureDir in try-catch blocks
This commit is contained in:
parent
329e3c7179
commit
5f1edcb609
5 changed files with 67 additions and 22 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue