mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-08 03:09:42 +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
|
|
@ -24,10 +24,15 @@ class CacheManager {
|
|||
this.ImageCachePath = Path.join(this.CachePath, 'images')
|
||||
this.ItemCachePath = Path.join(this.CachePath, 'items')
|
||||
|
||||
await fs.ensureDir(this.CachePath)
|
||||
await fs.ensureDir(this.CoverCachePath)
|
||||
await fs.ensureDir(this.ImageCachePath)
|
||||
await fs.ensureDir(this.ItemCachePath)
|
||||
try {
|
||||
await fs.ensureDir(this.CachePath)
|
||||
await fs.ensureDir(this.CoverCachePath)
|
||||
await fs.ensureDir(this.ImageCachePath)
|
||||
await fs.ensureDir(this.ItemCachePath)
|
||||
} catch (error) {
|
||||
Logger.error(`[CacheManager] Failed to create cache directories at "${this.CachePath}": ${error.message}`)
|
||||
throw new Error(`[CacheManager] Failed to create cache directories at "${this.CachePath}"`, { cause: error })
|
||||
}
|
||||
}
|
||||
|
||||
async handleCoverCache(res, libraryItemId, options = {}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue