spencermountain / wtf_wikipedia

a pretty-committed wikipedia markup parser
https://observablehq.com/@spencermountain/wtf_wikipedia
MIT License
779 stars 129 forks source link

Improve error handling: Cannot convert undefined or null to object #547

Closed MarketingPip closed 1 year ago

MarketingPip commented 1 year ago

When WTF-Wikipedia fetches and makes a good connection it will try to to convert things into a object.

A error should be thrown in cases where it is NOT able to convert it into an object.

Un-handled Errors:

/node_modules/wtf_wikipedia/src/_fetch/index.js:71:18
TypeError: Cannot convert undefined or null to object

Now obviously this is due to a URL being provided that is not a Wiki page etc. But still should be handled.

I will see if I can possibly get around to making a PR for this (feel free to do this before me), but leaving this here for now.

spencermountain commented 1 year ago

Good idea - PR welcomed for this.

MarketingPip commented 1 year ago

Closing issue as PR was made that addresses this.