Fixes bug where 'database exists' is reported when other couchdb errors are encountered.
This commit is contained in:
parent
a0c459aaa0
commit
508e1eec96
|
@ -96,13 +96,18 @@ module.exports = function(grunt) {
|
||||||
} else if (err.code && err.description) { // probably connection error
|
} else if (err.code && err.description) { // probably connection error
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
else if (_this.data.options && _this.data.options.okay_if_exists) {
|
else if (err.error && err.error=="file_exists") {
|
||||||
|
if (_this.data.options && _this.data.options.okay_if_exists) {
|
||||||
grunt.log.writeln("Database " + db.name + " exists, skipping");
|
grunt.log.writeln("Database " + db.name + " exists, skipping");
|
||||||
return done(null, null);
|
return done(null, null);
|
||||||
} else {
|
} else {
|
||||||
grunt.warn("Database " + db.name + " exists and okay_if_exists set to false. Aborting.");
|
grunt.warn("Database " + db.name + " exists and okay_if_exists set to false. Aborting.");
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
console.warn("Unrecognized error.");
|
||||||
|
throw err
|
||||||
|
}
|
||||||
} else if (res && res.ok==true) {
|
} else if (res && res.ok==true) {
|
||||||
grunt.log.ok("Database " + db.name + " created.");
|
grunt.log.ok("Database " + db.name + " created.");
|
||||||
return done(null, null);
|
return done(null, null);
|
||||||
|
|
Loading…
Reference in New Issue