Modules: error handling when importing declaratively?

# Axel Rauschmayer (12 years ago)

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.

# Sam Tobin-Hochstadt (12 years ago)

On Sun, Jul 28, 2013 at 5:09 PM, Axel Rauschmayer <axel at rauschma.de> wrote:

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.