refactor(router): makes an error message clearer

This commit is contained in:
vsavkin 2016-07-20 14:47:51 -07:00
parent 23ee29b6a2
commit eb6ff65af7
2 changed files with 2 additions and 2 deletions

View File

@ -525,7 +525,7 @@ function validateNode(route: Route): void {
if (route.redirectTo === undefined && !route.component && !route.children &&
!route.loadChildren) {
throw new Error(
`Invalid configuration of route '${route.path}': component, redirectTo, children, loadChildren must be provided`);
`Invalid configuration of route '${route.path}': one of the following must be provided (component or redirectTo or children or loadChildren)`);
}
if (route.path === undefined) {
throw new Error(`Invalid route configuration: routes must have path specified`);

View File

@ -51,7 +51,7 @@ describe('config', () => {
it('should throw when none of component and children or direct are missing', () => {
expect(() => { validateConfig([{path: 'a'}]); })
.toThrowError(
`Invalid configuration of route 'a': component, redirectTo, children, loadChildren must be provided`);
`Invalid configuration of route 'a': one of the following must be provided (component or redirectTo or children or loadChildren)`);
});
it('should throw when path starts with a slash', () => {