Skip to content

TagSpaces is an offline, open source, document manager with tagging support

improving error handling in promises

uggrocka65b828689fb
diff --git a/data/js/ioutils.js b/data/js/ioutils.js
index f95d4dfa5..0ede03bad 100644
--- a/data/js/ioutils.js
+++ b/data/js/ioutils.js
@@ -35,10 +35,10 @@ define(function(require, exports, module) {
return entry;
}
}
- }), function(err) {
- console.warn("Error walking directory prom " + err);
- return null;
- });
+ }));
+ }).catch(function(err) {
+ console.warn("Error walking directory " + err);
+ return null;
});
}
@@ -74,14 +74,10 @@ define(function(require, exports, module) {
var directoryIndex = [];
TSCORE.IOUtils.walkDirectory(dirPath, {recursive: true}, function(fileEntry) {
directoryIndex.push(fileEntry);
- }).then(
- function(entries) {
+ }).then(function(entries) {
TSPOSTIO.createDirectoryIndex(directoryIndex);
- },
- function(err) {
- console.warn("Error creating index: " + err);
- }
- ).catch(function() {
+ }).catch(function(err) {
+ console.warn("Error creating index: " + err);
TSCORE.hideWaitingDialog();
});
}