The code here i recently cant start the code cause error with cannt convert undefined or null to object :
Utils.getCardsInSets((ERR, DATA) => {
if (!ERR) {
allCards = DATA;
console.log("Card data loaded. [" + Object.keys(DATA).length + "]");
} else {
console.log("An error occurred while getting cards: " + ERR);
}
});
Error that showed on console
console.log("Card data loaded. [" + Object.keys(DATA).length + "]");
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at Utils.getCardsInSets (/root/test/index.js:37:52)
at Request.request [as _callback] (/root/test/utils.js:41:13)
at Request.self.callback (/root/test/node_modules/request/request.js:186:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.<anonymous> (/root/test/node_modules/request/request.js:1163:10)
at emitOne (events.js:115:13)
at Request.emit (events.js:210:7)
at IncomingMessage.<anonymous> (/root/test/node_modules/request/request.js:1085:12)
if (!ERR) { if(DATA){ allCards = DATA; console.log("Card data loaded. [" + Object.keys(DATA).length + "]"); }}