Fixing logic to return reject in promise
This commit is contained in:
parent
fdf0129e5d
commit
a0af3ff5d9
|
@ -231,14 +231,15 @@ EmbarkJS.Storage.IPFS = {
|
||||||
|
|
||||||
EmbarkJS.Storage.connect = function(provider){
|
EmbarkJS.Storage.connect = function(provider){
|
||||||
var self = this;
|
var self = this;
|
||||||
if (provider.toLowerCase() === EmbarkJS.Storage.Providers.IPFS) {
|
|
||||||
var promise = new Promise(function(resolve, reject) {
|
var promise = new Promise(function(resolve, reject) {
|
||||||
|
if (provider.toLowerCase() === EmbarkJS.Storage.Providers.IPFS) {
|
||||||
resolve(self.currentStorage.ipfsConnection);
|
resolve(self.currentStorage.ipfsConnection);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reject('Storage provider not supported');
|
var error = new Error(provider + ' storage provider not supported');
|
||||||
}
|
reject(error);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
|
@ -158,14 +158,15 @@ EmbarkJS.Storage.IPFS = {
|
||||||
|
|
||||||
EmbarkJS.Storage.connect = function(provider){
|
EmbarkJS.Storage.connect = function(provider){
|
||||||
var self = this;
|
var self = this;
|
||||||
if (provider.toLowerCase() === EmbarkJS.Storage.Providers.IPFS) {
|
|
||||||
var promise = new Promise(function(resolve, reject) {
|
var promise = new Promise(function(resolve, reject) {
|
||||||
|
if (provider.toLowerCase() === EmbarkJS.Storage.Providers.IPFS) {
|
||||||
resolve(self.currentStorage.ipfsConnection);
|
resolve(self.currentStorage.ipfsConnection);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reject('Storage provider not supported');
|
var error = new Error(provider + ' storage provider not supported');
|
||||||
}
|
reject(error);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue