Crashed with invalid link
alnidok opened this issue · comments
Bug Report
Current Behavior
I have text with link and I want to preview this link. JS crash if link is invalid or broken or something else.
There are examples in sandbox above.
It happens because endpoint https://api.microlink.io/?url=https://invalid-link returns "<required> an URL for getting content."
in data.url.
new URL('<required> an URL for getting content.')
throw error.
Expected behavior/code
Preview won't show but without crash.
Hello, and thanks a lot for reporting.
I improved this behavior at Microlink API:
https://api.microlink.io/?url=https://invalid-link
It returns now a proper error – can you check at your code level? it's now working as expected?
Thanks a lot for taking care about this 🙏
I released @microlink/mql@0.10.20
that address the issue.
Also, created a tiny playground to make easy reproduce errors in the future:
https://mql.microlink.io/?url=https://invald-url
If you just remove node_modules
and install again, the new version should be there; can you confirm? 🙂
Yes, now it works good. Thank you!