Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure require errbacks do not cause an error #36

Closed
jrburke opened this issue Aug 19, 2012 · 3 comments
Closed

Make sure require errbacks do not cause an error #36

jrburke opened this issue Aug 19, 2012 · 3 comments
Milestone

Comments

@jrburke
Copy link
Member

jrburke commented Aug 19, 2012

While almond will not call require errbacks, the usage in module code should not cause errors.

@zowens
Copy link

zowens commented Jun 12, 2013

@jrburke What's the motivation behind not calling the error callback when a module fails to load? I currently have some fallback behavior in an error callback that won't work with almond and would be willing to do a pull request with the error callback being applied.

@jrburke
Copy link
Member Author

jrburke commented Jun 14, 2013

The idea behind almond was that it was just a simpler AMD API provider for some modules that are already all built into a file. It cannot do dynamic loading, so the uses for an error handler did not seem worth increasing the size of almond as it would put a tax on all users of almond.

Feel free to create a fork of almond though and add the behavior. Then you can add it to this list so that others who may want it can find it:
https://github.com/jrburke/requirejs/wiki/AMD-API-Shims

@zowens
Copy link

zowens commented Jun 17, 2013

@jrburke I can imitate it easily with

setTimeout(function() {
     try {
         require(['modules-that-doesnt-exist'], function(dep){...}, undefined, true);
     } catch(e) {
         // .... failure behavior....
     }
}, 4);

But it seems like I could easily just change a couple lines in the main function around line 296 to check for, and invoke, an error callback... only a couple extra lines would be necessary. Plus it would keep parody with require.js without actually doing a dynamic script load.

Since I found a work-around, it's not critical, just thought I'd suggest it.

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

No branches or pull requests

2 participants