Importing modules that don't exist
John Barton
johnjbarton at google.com
Fri Nov 21 09:30:22 PST 2014
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
the importing line would be a good addition.
jjb
On Fri, Nov 21, 2014 at 9:18 AM, Andrea Giammarchi <
andrea.giammarchi at gmail.com> wrote:
> 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 <johnjbarton at google.com>
> wrote:
>
>> 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 feature/Modules/resources/no_such_file.js
>> // Error: locate resolved against base './'
>>
>> import * as b from './resources/no_such_file.js';
>>
>> jjb
>>
>> On Fri, Nov 21, 2014 at 3:49 AM, Marius Gundersen <gundersen at gmail.com>
>> wrote:
>>
>>>
>>>
>>> On Fri, Nov 21, 2014 at 11:49 AM, Andrea Giammarchi <
>>> andrea.giammarchi at 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 is very useful for the
>>> error to include not only the module that couldn't be loaded but also the
>>> module that requested it. These two fields should be on the Error object,
>>> and so a new ImportError with the field `missingModule` and `requestedBy`
>>> (or something similar) sounds like a good solution to me.
>>>
>>> Marius Gundersen
>>>
>>> _______________________________________________
>>> es-discuss mailing list
>>> es-discuss at mozilla.org
>>> https://mail.mozilla.org/listinfo/es-discuss
>>>
>>>
>>
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at mozilla.org
>> https://mail.mozilla.org/listinfo/es-discuss
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141121/11a5683d/attachment.html>
More information about the es-discuss
mailing list