Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Handle script load errors #14

Closed
tomwayson opened this issue Apr 2, 2017 · 5 comments · Fixed by #45
Closed

Handle script load errors #14

tomwayson opened this issue Apr 2, 2017 · 5 comments · Fixed by #45

Comments

@tomwayson
Copy link
Member

As suggested by @davetimmins in #13 (comment)

I've actually implemented this in the ember version and that could be used for reference.

@nicksenger
Copy link

Hi @tomwayson , can you provide an example of how one would handle script loading errors using esriLoader.dojoRequire without accessing window['require'] directly?

I see the onScriptError defined in bootstrap, but can't seem to figure out how/if that relates to dojoRequire

@davetimmins
Copy link
Contributor

@nicksenger I think it assumes you've already called bootstrap and the onload in dojoRequire is just to be notified of the currently loading script, so if it errors you'd still get the error from the original bootstrap call

@tomwayson
Copy link
Member Author

tomwayson commented Nov 9, 2017

Correct @davetimmins and good point @nicksenger. I guess that is a bit of an oversight. If you don't use bootstrap() to load the script you won't necessarily have a way to handle the script loading errors.

A bigger issue is that dojoRequire() doesn't give you any way to handle any errors, regardless of whether they happened while loading the script or the modules, the way that esriPromise() does. I'm about to push a branch that uses promises instead of callbacks, and basically is a wholesale rip off the esriPromise() API (and some of it's source code - thanks @nicksenger 😉). That will be a better solution to #14 (comment).

@andygup
Copy link
Member

andygup commented Nov 9, 2017

@tomwayson do you know of specific errors that would bubble? I haven't seen any yet, but haven't really tested for it. For example, "require not defined", or what would happen if a module fails with like a 504 error?

@tomwayson
Copy link
Member Author

Well @andygup I've seen my share of module 404s through the years, mostly due to misconfigured packages.

The above issues will be handled in #48

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants