cujojs / curl

curl.js is small, fast, extensible module loader that handles AMD, CommonJS Modules/1.1, CSS, HTML/text, and legacy scripts.
https://github.com/cujojs/curl/wiki
Other
1.89k stars 216 forks source link

feedback on error #117

Closed jpcaruana closed 11 years ago

jpcaruana commented 11 years ago

Hi, when curl fails to load files (eg. circular dependency), there is no feedback to help, not even an error. It would be great to have some kind of feedback : a console log, an error or even a (horrible) alert window.

unscriptable commented 11 years ago

Hey @jpcaruana!

Are you using AMD-wrapped commonjs modules? Just wondering because they allow curl.js to detect and circumvent circular dependencies. It's problematic (and cpu-intensive) to detect cycles in "normal" AMD modules.

Fwiw, I never advocate coding cycles on purpose. There's never a good use case for them. :)

On the other hand, there's always the possibility of a circular dependency happening by accident. curl.js doesn't offer any feedback when this happens. I guess this is what you encountered?

I guess I should add some documentation that explains that silence means a circular dependency. (Some plugins can cause silent failures, too, actually.) 404s, mismatched module ids, and syntax errors are noisy -- as you'd expect.

Thanks for alerting me to this. I'll fix the docs.

Regards,

-- John

jpcaruana commented 11 years ago

Ok. Thanks for your answer. I'll try to avoid circular dependency next time :) Regards, -- JP

stevenvachon commented 11 years ago

I'm getting no feedback on a 404.

I combined curl with the plugins: css, j, text

curl(
    [
        "js!scripts/library.js",
        "css!stylesheets/style.css",
        "text!templates/template.html",
        "js!scripts/library123.js"  // renamed to cause a 404
    ]
).then(
    function(){ console.log(arguments); },
    function(){ console.log("ERROR"); } // never called
);

Here is the browser (Safari) error in the console: Failed to load resource file://localhost/Users/user/Desktop/Test/scripts/library123.js