Better error checking for invalid markets

This commit is contained in:
joeuhren
2020-12-08 22:52:15 -07:00
parent 63fb0ad488
commit 2acb681b5a
4 changed files with 83 additions and 66 deletions
+12 -9
View File
@@ -28,15 +28,18 @@ db.connect(dbString, function() {
// check markets
var markets = settings.markets.enabled;
for (var i = 0; i < markets.length; i++) {
db.check_market(markets[i], function(market, exists) {
if(exists == false) {
console.log('no %s entry found, creating now..', market);
db.create_market(settings.markets.coin, settings.markets.exchange, market, function(){
});
}
});
}
// check if market is installed
if (db.fs.existsSync('./lib/markets/' + markets[i] + '.js')) {
db.check_market(markets[i], function(market, exists) {
if (exists == false) {
console.log('no %s entry found, creating now..', market);
db.create_market(settings.markets.coin, settings.markets.exchange, market, function() {
});
}
});
}
}
db.check_richlist(settings.coin, function(exists){
if (exists == false) {
console.log('no richlist entry found, creating now..');