mirror of
https://github.com/bower/bower.git
synced 2026-02-12 15:05:05 -05:00
Throw an error if already resolving.
This commit is contained in:
@@ -45,6 +45,15 @@ Resolver.prototype.hasNew = function (canonicalPkg) {
|
||||
Resolver.prototype.resolve = function () {
|
||||
var that = this;
|
||||
|
||||
// If already resolving, throw an error
|
||||
// We don't actually reject a promise because this is a
|
||||
// serious logic error
|
||||
if (this._resolving) {
|
||||
throw new Error('Already resolving');
|
||||
}
|
||||
|
||||
this._resolving = true;
|
||||
|
||||
// Create temporary dir
|
||||
return this._createTempDir()
|
||||
// Resolve self
|
||||
@@ -62,9 +71,11 @@ Resolver.prototype.resolve = function () {
|
||||
]);
|
||||
})
|
||||
.then(function () {
|
||||
that._resolving = false;
|
||||
// Resolve with the folder
|
||||
return that._tempDir;
|
||||
}, function (err) {
|
||||
that._resolving = false;
|
||||
// If something went wrong, unset the temporary dir
|
||||
that._tempDir = null;
|
||||
throw err;
|
||||
|
||||
Reference in New Issue
Block a user