mobiletto 1.0.22 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +14 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -66,7 +66,8 @@ const UTILITY_FUNCTIONS = {
|
|
|
66
66
|
cacheKey = shasum(path + ' ' + (opts ? JSON.stringify(opts) : '~'))
|
|
67
67
|
const results = client.listingCache.get(cacheKey)
|
|
68
68
|
if (results) {
|
|
69
|
-
return results
|
|
69
|
+
if (results.cached) { return results }
|
|
70
|
+
throw results
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
const recursive = opts && opts.recursive ? opts.recursive : false
|
|
@@ -74,11 +75,19 @@ const UTILITY_FUNCTIONS = {
|
|
|
74
75
|
if (visitor && typeof visitor !== 'function') {
|
|
75
76
|
throw new MobilettoError(`list: visitor is not a function: ${typeof visitor}`)
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
client.listingCache
|
|
78
|
+
try {
|
|
79
|
+
const results = await client.driver_list(path, recursive, visitor)
|
|
80
|
+
if (client.listingCache) {
|
|
81
|
+
results.cached = true
|
|
82
|
+
client.listingCache.set(cacheKey, results)
|
|
83
|
+
}
|
|
84
|
+
return results
|
|
85
|
+
} catch (e) {
|
|
86
|
+
if (client.listingCache && e instanceof MobilettoNotFoundError) {
|
|
87
|
+
client.listingCache.set(cacheKey, e)
|
|
88
|
+
}
|
|
89
|
+
throw e
|
|
80
90
|
}
|
|
81
|
-
return results
|
|
82
91
|
},
|
|
83
92
|
safeList: (client) => async (path, opts) => {
|
|
84
93
|
const recursive = opts && opts.recursive ? opts.recursive : false
|