When defining a word that has no definition (try with random key mashing) the bot would still print No results found! due to the .catch, however it would also error in the for loop. If the content existed of multiple words it would be:
TypeError: Cannot read property 'meanings' of undefined
at superagent.get.then.then (<Path-To-App-And-Line>)
at process._tickCallback (internal/process/next_tick.js:103:7)
And if the content existed of a single word then the error would be:
TypeError: Cannot read property 'filter' of undefined
at superagent.get.then.then (<Path-To-App-And-Line>)
at process._tickCallback (internal/process/next_tick.js:103:7)
By simple ensuring that tuc exists prior to continuing this issue is avoided and there will be a lot less spam in an error log. A simple console.log(res) right after .then((res) => { revealed that if no definition is found there is no tuc
When defining a word that has no definition (try with random key mashing) the bot would still print No results found! due to the
.catch
, however it would also error in the for loop. If the content existed of multiple words it would be:And if the content existed of a single word then the error would be:
By simple ensuring that
tuc
exists prior to continuing this issue is avoided and there will be a lot less spam in an error log. A simpleconsole.log(res)
right after.then((res) => {
revealed that if no definition is found there is notuc
log with definition:
Log without definition: