feature(@package/embarkjs): warn when a embarkjs plugin might be missing

This commit is contained in:
Iuri Matias 2020-01-15 13:17:38 -05:00
parent 8691716346
commit 7a3bf59c81
4 changed files with 19 additions and 3 deletions

View File

@ -78,6 +78,10 @@ Blockchain.setProvider = function(providerName, options) {
let provider = this.Providers[providerName];
if (!provider) {
if (providerName === 'web3') {
console.log("the embarkjs-web3 package might be missing from your project dependencies");
}
throw new Error([
'Unknown blockchain provider. Make sure to register it first using',
'EmbarkJS.Blockchain.registerProvider(providerName, providerObject)'

View File

@ -10,7 +10,10 @@ Messages.setProvider = function (providerName, options) {
let provider = this.Providers[providerName];
if (!provider) {
throw new Error('Unknown messages provider');
if (providerName === 'whisper') {
console.log("the embarkjs-whisper package might be missing from your project dependencies");
}
throw new Error('Unknown messages provider: ' + providerName);
}
this.currentProviderName = providerName;

View File

@ -11,7 +11,10 @@ Names.setProvider = function(providerName, options) {
let provider = this.Providers[providerName];
if (!provider) {
throw new Error('Unknown name system provider');
if (providerName === 'ens') {
console.log("the embarkjs-ens package might be missing from your project dependencies");
}
throw new Error('Unknown name system provider: ' + providerName);
}
this.currentProviderName = providerName;

View File

@ -56,7 +56,13 @@ Storage.setProvider = function (providerName, options) {
let provider = this.Providers[providerName];
if (!provider) {
throw new Error('Unknown storage provider');
if (providerName === 'ipfs') {
console.log("the embarkjs-ipfs package might be missing from your project dependencies");
}
if (providerName === 'swarm') {
console.log("the embarkjs-swarm package might be missing from your project dependencies");
}
throw new Error('Unknown storage provider: ' + providerName);
}
this.currentProviderName = providerName;