fix(router): improve error message (#12102)

This commit is contained in:
vsavkin 2016-10-06 14:24:33 -07:00 committed by Tobias Bosch
parent 40b92ddf21
commit e06303a987
2 changed files with 4 additions and 4 deletions

View File

@ -98,7 +98,7 @@ class ApplyRedirects {
} }
private noMatchError(e: NoMatch): any { private noMatchError(e: NoMatch): any {
return new Error(`Cannot match any routes: '${e.segmentGroup}'`); return new Error(`Cannot match any routes. URL Segment: '${e.segmentGroup}'`);
} }
private createUrlTree(rootCandidate: UrlSegmentGroup): UrlTree { private createUrlTree(rootCandidate: UrlSegmentGroup): UrlTree {

View File

@ -293,7 +293,7 @@ describe('applyRedirects', () => {
(e) => { throw 'Should not reach'; }); (e) => { throw 'Should not reach'; });
}); });
it('should load the configuration of a whilecard route', () => { it('should load the configuration of a wildcard route', () => {
const loadedConfig = new LoadedRouterConfig( const loadedConfig = new LoadedRouterConfig(
[{path: '', component: ComponentB}], <any>'stubInjector', <any>'stubFactoryResolver'); [{path: '', component: ComponentB}], <any>'stubInjector', <any>'stubFactoryResolver');
@ -353,7 +353,7 @@ describe('applyRedirects', () => {
applyRedirects(null, null, tree('b'), config) applyRedirects(null, null, tree('b'), config)
.subscribe( .subscribe(
(_) => { throw 'Should not be reached'; }, (_) => { throw 'Should not be reached'; },
e => { expect(e.message).toEqual('Cannot match any routes: \'b\''); }); e => { expect(e.message).toEqual('Cannot match any routes. URL Segment: \'b\''); });
}); });
it('redirect from an empty path should work (nested case)', () => { it('redirect from an empty path should work (nested case)', () => {
@ -483,7 +483,7 @@ describe('applyRedirects', () => {
applyRedirects(null, null, tree('a/(d//aux:e)'), config) applyRedirects(null, null, tree('a/(d//aux:e)'), config)
.subscribe( .subscribe(
(_) => { throw 'Should not be reached'; }, (_) => { throw 'Should not be reached'; },
e => { expect(e.message).toEqual('Cannot match any routes: \'a\''); }); e => { expect(e.message).toEqual('Cannot match any routes. URL Segment: \'a\''); });
}); });
}); });
}); });