refactor(Compiler): improve the error message on component load error

by adding the fetched url.

relates to #1460
This commit is contained in:
Victor Berchet
2015-06-01 11:07:14 +02:00
parent a504fa835e
commit c60091b949
4 changed files with 15 additions and 9 deletions

View File

@ -103,7 +103,8 @@ export function runCompilerCommonTests() {
PromiseWrapper.catchError(
compiler.compile(new ViewDefinition({componentId: 'someId', absUrl: 'someUrl'})),
(e) => {
expect(e.message).toContain(`Failed to load the template "someId"`);
expect(e.message).toEqual(
'Failed to load the template for "someId" : Failed to fetch url "someUrl"');
async.done();
return null;
});
@ -208,9 +209,9 @@ class FakeTemplateLoader extends TemplateLoader {
if (isPresent(template.absUrl)) {
var content = MapWrapper.get(this._urlData, template.absUrl);
if (isPresent(content)) {
return PromiseWrapper.resolve(DOM.createTemplate(content));
}
return isPresent(content) ?
PromiseWrapper.resolve(DOM.createTemplate(content)) :
PromiseWrapper.reject(`Failed to fetch url "${template.absUrl}"`, null);
}
return PromiseWrapper.reject('Load failed', null);