kubetail-org / loadjs

A tiny async loader / dependency manager for modern browsers (899 bytes)
MIT License
2.57k stars 149 forks source link

More details than "path not found" #110

Closed cheryly279 closed 3 months ago

cheryly279 commented 3 months ago

Is there some way of determining why we ended up in the error callback? The documentation makes it seem like it's just thought of as the path was not found, but what if there was some other reason the library couldn't load? For instance, what if there was a 429 response code indicating a rate limiter had been hit?

amorey commented 3 months ago

This library loads files via the <script> tag in order to enable cross-domain requests but the downside is that it can't access the response code. If you load files with an XMLHttpRequest or fetch() call you'll be able to access the HTTP response but only for same-site requests or cross-site requests with CORS enabled.

cheryly279 commented 3 months ago

Ah I see, thanks!