mirror of https://github.com/embarklabs/embark.git
throw exeption if provider has not been set
This commit is contained in:
parent
82681fec8f
commit
471fb1a061
18
js/embark.js
18
js/embark.js
|
@ -188,18 +188,30 @@ EmbarkJS.Storage.Providers = {
|
|||
};
|
||||
|
||||
EmbarkJS.Storage.saveText = function(text) {
|
||||
if (!this.currentStorage) {
|
||||
throw new Error('Storage provider not set; e.g EmbarkJS.Storage.setProvider("ipfs")');
|
||||
}
|
||||
return this.currentStorage.saveText(text);
|
||||
};
|
||||
|
||||
EmbarkJS.Storage.get = function(hash) {
|
||||
if (!this.currentStorage) {
|
||||
throw new Error('Storage provider not set; e.g EmbarkJS.Storage.setProvider("ipfs")');
|
||||
}
|
||||
return this.currentStorage.get(hash);
|
||||
};
|
||||
|
||||
EmbarkJS.Storage.uploadFile = function(inputSelector) {
|
||||
if (!this.currentStorage) {
|
||||
throw new Error('Storage provider not set; e.g EmbarkJS.Storage.setProvider("ipfs")');
|
||||
}
|
||||
return this.currentStorage.uploadFile(inputSelector);
|
||||
};
|
||||
|
||||
EmbarkJS.Storage.getUrl = function(hash) {
|
||||
if (!this.currentStorage) {
|
||||
throw new Error('Storage provider not set; e.g EmbarkJS.Storage.setProvider("ipfs")');
|
||||
}
|
||||
return this.currentStorage.getUrl(hash);
|
||||
};
|
||||
|
||||
|
@ -240,10 +252,16 @@ EmbarkJS.Messages.setProvider = function(provider, options) {
|
|||
};
|
||||
|
||||
EmbarkJS.Messages.sendMessage = function(options) {
|
||||
if (!this.currentMessages) {
|
||||
throw new Error('Messages provider not set; e.g EmbarkJS.Messages.setProvider("whisper")');
|
||||
}
|
||||
return this.currentMessages.sendMessage(options);
|
||||
};
|
||||
|
||||
EmbarkJS.Messages.listenTo = function(options) {
|
||||
if (!this.currentMessages) {
|
||||
throw new Error('Messages provider not set; e.g EmbarkJS.Messages.setProvider("whisper")');
|
||||
}
|
||||
return this.currentMessages.listenTo(options);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue