« get me outta code hell

Hide/fix weird bug with empty downloaderArgs - mtui - Music Text User Interface - user-friendly command line music player
about summary refs log tree commit diff
path: root/downloaders.js
diff options
context:
space:
mode:
authorFlorrie <towerofnix@gmail.com>2018-06-26 22:11:35 -0300
committerFlorrie <towerofnix@gmail.com>2018-06-26 22:11:47 -0300
commit2d41fd5ce9e2c821ea4da8a6650f445dbf48d641 (patch)
treef48af3fe769b7258b9689d6df913ef2dfa20fa73 /downloaders.js
parent992911a021e2f2cccfbc63e554a3f34bd997cd91 (diff)
Hide/fix weird bug with empty downloaderArgs
Diffstat (limited to 'downloaders.js')
-rw-r--r--downloaders.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/downloaders.js b/downloaders.js
index 1e2a9e9..b7582a9 100644
--- a/downloaders.js
+++ b/downloaders.js
@@ -19,6 +19,11 @@ const copyFile = fse.copy
 
 const cachify = (identifier, baseFunction) => {
   return async arg => {
+    // If there was no argument passed (or it aws empty), nothing will work..
+    if (!arg) {
+      throw new TypeError('Expected a downloader argument')
+    }
+
     // Determine where the final file will end up. This is just a directory -
     // the file's own name is determined by the downloader.
     const cacheDir = downloaders.rootCacheDir + '/' + identifier