Modules: error handling when importing declaratively?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Modules: error handling when importing declaratively?

Axel Rauschmayer

When you import a module programmatically, you have an error callback:

     Loader.prototype.import( name, callback, errback, referer = null )

How do you handle errors when you import declaratively? I’d expect by registering an event listener with the current loader, but haven’t found anything in the loader API.

Axel

-- 
Dr. Axel Rauschmayer



_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Modules: error handling when importing declaratively?

Sam Tobin-Hochstadt
On Sun, Jul 28, 2013 at 5:09 PM, Axel Rauschmayer <[hidden email]> wrote:
> http://wiki.ecmascript.org/doku.php?id=harmony:module_loaders
>
> When you import a module programmatically, you have an error callback:
>
>      Loader.prototype.import( name, callback, errback, referer = null )
>
> How do you handle errors when you import declaratively? I’d expect by
> registering an event listener with the current loader, but haven’t found
> anything in the loader API.

This is confusing the meta-levels.  Compilation is always started with
by (a) some call to Loader.prototype.import or another Loader
function, or (b) a declarative form in the page, such as a <script>
tag.  In (a), there's an error handler given in the call.  In (b),
it's like any other static error in the page, like a syntax error.

Sam
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss