« get me outta code hell

Return empty playlist for nonexistant directories - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-06-12 23:05:00 -0300
committerFlorrie <towerofnix@gmail.com>2018-06-12 23:05:00 -0300
commitc3628a57bc43492e32b9251750865e41d68efea0 (patch)
treeddc63ccd4c05cd6420a9403f6df54b0528f85474
parent70d6ea774ce47ca1a12cde8040c345de49beb29b (diff)
Return empty playlist for nonexistant directories
-rw-r--r--crawlers.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/crawlers.js b/crawlers.js
index 8ba70f3..61f422b 100644
--- a/crawlers.js
+++ b/crawlers.js
@@ -219,6 +219,10 @@ function crawlLocal(dirPath, extensions = [
         }
       })
     }))
+  }, err => {
+    if (err.code === 'ENOENT') {
+      return []
+    }
   }).then(items => items.filter(Boolean))
     .then(filteredItems => ({items: filteredItems}))
 }