Re: Importing modules that don't exist

2014-11-21 Thread Andrea Giammarchi
a native ImportError seems to me the best option and it's also easy to polyfill in a meaningful way with all current module loaders used already out there. just my 2 cents On Fri, Nov 21, 2014 at 3:10 AM, Isiah Meadows impinb...@gmail.com wrote: Should we, then, throw a SyntaxError, a new

Re: Importing modules that don't exist

2014-11-21 Thread Marius Gundersen
On Fri, Nov 21, 2014 at 11:49 AM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: a native ImportError seems to me the best option and it's also easy to polyfill in a meaningful way with all current module loaders used already out there. My experience with AMD and require.js is that it

Re: Importing modules that don't exist

2014-11-21 Thread John Barton
Traceur reports such errors like this: // Error: File not found 'feature/Modules/resources/no_such_file.js' // Error: Specified as ./resources/no_such_file.js. // Error: Imported by feature/Modules/Error_InvalidModuleDeclaration.module.js. // Error: Normalizes to

Re: Importing modules that don't exist

2014-11-21 Thread Andrea Giammarchi
to be honest I think that `.file` and `.line` would cover the who imported what scenario but those look like a very good/complete `.message` for such error, nice job On Fri, Nov 21, 2014 at 3:37 PM, John Barton johnjbar...@google.com wrote: Traceur reports such errors like this: // Error:

Re: Importing modules that don't exist

2014-11-21 Thread John Barton
At least using the older loader spec 'file' and 'line' alone is not enough information for the loader to determine which file to load. I think the error message should echo all of the information the developer would need to recreate the error state and hopefully diagnose the issue. I agree that

Re: Importing modules that don't exist

2014-11-21 Thread Andrea Giammarchi
if we have that and a very descriptive message then we won't need new properties there but still I think having a different kind of instanceof Error is helpful too. It's hard to guess through message parsing otherwise ;-) On Fri, Nov 21, 2014 at 5:30 PM, John Barton johnjbar...@google.com wrote:

Re: Importing modules that don't exist

2014-11-21 Thread Marius Gundersen
On Fri, Nov 21, 2014 at 6:39 PM, Andrea Giammarchi andrea.giammar...@gmail.com wrote: if we have that and a very descriptive message then we won't need new properties there but still I think having a different kind of instanceof Error is helpful too. It's hard to guess through message parsing

Re: Importing modules that don't exist

2014-11-21 Thread Isiah Meadows
Easy enough: ```js class ImportError extends Error {} ``` Now, patching module loaders would be a whole different beast. For Node, luckily, it's as simple as this, if turning it into a runtime error is permissible (very similar for other cases): ```js // original import foo from ./module.js;

Re: Importing modules that don't exist

2014-11-20 Thread Isiah Meadows
Should we, then, throw a SyntaxError, a new Error subclass created for the purpose, since we don't have a dedicated Error class for it yet (e.g. ImportError), or just a generic Error? My thoughts about each option: 1. SyntaxError isn't relevant, since it's about a file that doesn't exist, not an

Importing modules that don't exist

2014-11-13 Thread Isiah Meadows
What happens if a module isn't able to be found? Is that implementation defined, or have I missed it in the spec? ___ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss

Re: Importing modules that don't exist

2014-11-13 Thread Calvin Metcalf
It should throw a static error, the loader is where this is specified I believe, but it looks like the loader was pulled out into it's own spec https://github.com/rwaldron/tc39-notes/blob/b1af70ec299e996a9f1e2e34746269fbbb835d7e/es6/2014-09/sept-25.md#loader-pipeline, not sure where that ended up

Re: Importing modules that don't exist

2014-11-13 Thread Allen Wirfs-Brock
On Nov 13, 2014, at 5:16 AM, Calvin Metcalf wrote: It should throw a static error, the loader is where this is specified I believe, but it looks like the loader was pulled out into it's own spec