lgraubner / sitemap-generator

Easily create XML sitemaps for your website.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"error" event not triggered if initial URL is unreachable

jsthind opened this issue · comments

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Passing an unreachable domain (For example http://sdfdfdteterter.com ) does not trigger the "error" event.

If the current behavior is a bug, please provide the steps to reproduce.
const generator = SitemapGenerator("http://sdfdfdteterter.com"); generator.start();

What is the expected behavior?
"error" event should be triggered if the initial URL is unreachable.

I think this is resolved? tried with the above domain and error is firing:
throw new Error(Site "${parsedUrl.href}" could not be found.);
^

Error: Site "https://sdfdfdteterter.com" could not be found.

Not sure, there might be some edge cases. The error @Rob-Rychs got is caused by a client error (but might be thrown if site is not reachable/dns entry not found. (See here). Additionally you could subscribe to the error event which might fire a 404.

If this issue is not solve can I take this up?

Sure, go for it.

how's it coming @Nayan-Das ?