Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Trapping stat errors

  • Loading branch information...
commit b5c2abaea352af732b7b8f7314036f4773331c3e 1 parent 66d0e2d
@bermi authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 lib/cloudfiles-mirror/core.js
View
13 lib/cloudfiles-mirror/core.js
@@ -237,11 +237,15 @@ _.extend(CloudfilesMirror.prototype, {
handleChange: function (event_type, file, stats) {
var file_details;
- if (_.isFunction(stats.isFile) && !stats.isFile()) {
- return;
+ try {
+ if ((!stats || !stats.isFile) || (_.isFunction(stats.isFile) && !stats.isFile())) {
+ return;
+ }
+ file_details = this.getFileDetails(file);
+ this.emit("local.file." + event_type, file, file_details.mime, file_details.extension, stats);
+ } catch (e) {
+ this.emit("error", e);
}
- file_details = this.getFileDetails(file);
- this.emit("local.file." + event_type, file, file_details.mime, file_details.extension, stats);
},
getFileDetails: function (file) {
@@ -295,5 +299,4 @@ escapeRegExp = (function () {
};
}());
-
module.exports = CloudfilesMirror;
Please sign in to comment.
Something went wrong with that request. Please try again.