tuzgen / wikibot

Wikipedia query tool for Discord
MIT License
2 stars 1 forks source link

SEARCHING WIKIBOT YIELDS AN ERROR #1

Open SelcuukYilmazz opened 3 years ago

SelcuukYilmazz commented 3 years ago

SEARCHING WIKIBOT YIELDS AN ERROR

Bugs

if you seach wikibot program gives error and don't give you any result

Command: ~~wikisearch wikibot

CONSOLE OUTPUT


    at createSearchEmbed (D:\dev\projects\discord_bots\wikibot\index.js:120:46)
    at wikiSearch (D:\dev\projects\discord_bots\wikibot\index.js:94:7)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Client.<anonymous> (D:\dev\projects\discord_bots\wikibot\index.js:35:7)
(node:16892) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside
 of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate 
the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict`
 (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16892) [DEP0018] DeprecationWarning: Unhandled promise rejections 
are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a 
non-zero exit code.```
tuzgen commented 3 years ago

I think this issue occurs because of the Did you mean? section in the searchEmbed. Since there are no more than one result for the ~~wikisearch wikibot query, there will be a null referencing issue. Off the top of my head I think checking for null references before adding fields should prevent this error.