« get me outta code hell

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:
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