From 91cc6ed88f06f97a6b7f7a6a5b8b9d49a865eaae Mon Sep 17 00:00:00 2001 From: kouMatsumoto Date: Sun, 29 Jul 2018 12:09:45 +0900 Subject: [PATCH] feat(schematics): display provided path when displaying an error (#1208) Closes #1200 --- modules/effects/schematics-core/utility/find-module.ts | 2 +- modules/effects/schematics-core/utility/ngrx-utils.ts | 4 ++-- modules/entity/schematics-core/utility/find-module.ts | 2 +- modules/entity/schematics-core/utility/ngrx-utils.ts | 4 ++-- modules/router-store/schematics-core/utility/find-module.ts | 2 +- modules/router-store/schematics-core/utility/ngrx-utils.ts | 4 ++-- modules/schematics-core/utility/find-module.ts | 2 +- modules/schematics-core/utility/ngrx-utils.ts | 4 ++-- modules/schematics/schematics-core/utility/find-module.ts | 2 +- modules/schematics/schematics-core/utility/ngrx-utils.ts | 4 ++-- modules/schematics/src/effect/index.ts | 2 +- modules/schematics/src/store/index.ts | 2 +- modules/store-devtools/schematics-core/utility/find-module.ts | 2 +- modules/store-devtools/schematics-core/utility/ngrx-utils.ts | 4 ++-- modules/store/schematics-core/utility/find-module.ts | 2 +- modules/store/schematics-core/utility/ngrx-utils.ts | 4 ++-- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/modules/effects/schematics-core/utility/find-module.ts b/modules/effects/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/effects/schematics-core/utility/find-module.ts +++ b/modules/effects/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/effects/schematics-core/utility/ngrx-utils.ts b/modules/effects/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/effects/schematics-core/utility/ngrx-utils.ts +++ b/modules/effects/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/entity/schematics-core/utility/find-module.ts b/modules/entity/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/entity/schematics-core/utility/find-module.ts +++ b/modules/entity/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/entity/schematics-core/utility/ngrx-utils.ts b/modules/entity/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/entity/schematics-core/utility/ngrx-utils.ts +++ b/modules/entity/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/router-store/schematics-core/utility/find-module.ts b/modules/router-store/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/router-store/schematics-core/utility/find-module.ts +++ b/modules/router-store/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/router-store/schematics-core/utility/ngrx-utils.ts b/modules/router-store/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/router-store/schematics-core/utility/ngrx-utils.ts +++ b/modules/router-store/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/schematics-core/utility/find-module.ts b/modules/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/schematics-core/utility/find-module.ts +++ b/modules/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/schematics-core/utility/ngrx-utils.ts b/modules/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/schematics-core/utility/ngrx-utils.ts +++ b/modules/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/schematics/schematics-core/utility/find-module.ts b/modules/schematics/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/schematics/schematics-core/utility/find-module.ts +++ b/modules/schematics/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/schematics/schematics-core/utility/ngrx-utils.ts b/modules/schematics/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/schematics/schematics-core/utility/ngrx-utils.ts +++ b/modules/schematics/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/schematics/src/effect/index.ts b/modules/schematics/src/effect/index.ts index b2def221f7..40a599a191 100644 --- a/modules/schematics/src/effect/index.ts +++ b/modules/schematics/src/effect/index.ts @@ -35,7 +35,7 @@ function addImportToNgModule(options: EffectOptions): Rule { } if (!host.exists(modulePath)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/schematics/src/store/index.ts b/modules/schematics/src/store/index.ts index 61eb968ae4..7efe5decfa 100644 --- a/modules/schematics/src/store/index.ts +++ b/modules/schematics/src/store/index.ts @@ -35,7 +35,7 @@ function addImportToNgModule(options: StoreOptions): Rule { } if (!host.exists(modulePath)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/store-devtools/schematics-core/utility/find-module.ts b/modules/store-devtools/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/store-devtools/schematics-core/utility/find-module.ts +++ b/modules/store-devtools/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/store-devtools/schematics-core/utility/ngrx-utils.ts b/modules/store-devtools/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/store-devtools/schematics-core/utility/ngrx-utils.ts +++ b/modules/store-devtools/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath); diff --git a/modules/store/schematics-core/utility/find-module.ts b/modules/store/schematics-core/utility/find-module.ts index bdc442332d..2e8379f877 100644 --- a/modules/store/schematics-core/utility/find-module.ts +++ b/modules/store/schematics-core/utility/find-module.ts @@ -57,7 +57,7 @@ export function findModuleFromOptions( } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) { return normalize(modulePath + '/' + moduleBaseName + '.module.ts'); } else { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } } } diff --git a/modules/store/schematics-core/utility/ngrx-utils.ts b/modules/store/schematics-core/utility/ngrx-utils.ts index 1873ad0446..02745f96ba 100644 --- a/modules/store/schematics-core/utility/ngrx-utils.ts +++ b/modules/store/schematics-core/utility/ngrx-utils.ts @@ -16,7 +16,7 @@ export function addReducerToState(options: any): Rule { const reducersPath = normalize(`/${options.path}/${options.reducers}`); if (!host.exists(reducersPath)) { - throw new Error('Specified reducers path does not exist'); + throw new Error(`Specified reducers path ${reducersPath} does not exist`); } const text = host.read(reducersPath); @@ -192,7 +192,7 @@ export function addReducerImportToNgModule(options: any): Rule { const modulePath = options.module; if (!host.exists(options.module)) { - throw new Error('Specified module does not exist'); + throw new Error(`Specified module path ${modulePath} does not exist`); } const text = host.read(modulePath);