|
8 | 8 |
|
9 | 9 | import {normalize} from '@angular-devkit/core'; |
10 | 10 | import {WorkspaceProject, WorkspaceSchema} from '@angular-devkit/core/src/workspace'; |
11 | | -import {Tree} from '@angular-devkit/schematics'; |
| 11 | +import {SchematicsException, Tree} from '@angular-devkit/schematics'; |
12 | 12 | import { |
13 | 13 | getProjectFromWorkspace, |
14 | 14 | getProjectStyleFile, |
@@ -62,8 +62,8 @@ function insertCustomTheme(project: WorkspaceProject, projectName: string, host: |
62 | 62 |
|
63 | 63 | if (!stylesPath) { |
64 | 64 | if (!project.sourceRoot) { |
65 | | - throw new Error(`Could not find source root for project: "${projectName}". Please make ` + |
66 | | - `sure that the "sourceRoot" property is set in the workspace config.`); |
| 65 | + throw new SchematicsException(`Could not find source root for project: "${projectName}". ` + |
| 66 | + `Please make sure that the "sourceRoot" property is set in the workspace config.`); |
67 | 67 | } |
68 | 68 |
|
69 | 69 | // Normalize the path through the devkit utilities because we want to avoid having |
@@ -159,9 +159,9 @@ function validateDefaultTargetBuilder(project: WorkspaceProject, targetName: 'bu |
159 | 159 | // builder has been changed, we warn because a theme is not mandatory for running tests |
160 | 160 | // with Material. See: https://github.com/angular/material2/issues/14176 |
161 | 161 | if (!isDefaultBuilder && targetName === 'build') { |
162 | | - throw new Error(`Your project is not using the default builders for "${targetName}". The ` + |
163 | | - `Angular Material schematics cannot add a theme to the workspace configuration if the ` + |
164 | | - `builder has been changed. Exiting..`); |
| 162 | + throw new SchematicsException(`Your project is not using the default builders for ` + |
| 163 | + `"${targetName}". The Angular Material schematics cannot add a theme to the workspace ` + |
| 164 | + `configuration if the builder has been changed.`); |
165 | 165 | } else if (!isDefaultBuilder) { |
166 | 166 | console.warn(`Your project is not using the default builders for "${targetName}". This ` + |
167 | 167 | `means that we cannot add the configured theme to the "${targetName}" target.`); |
|
0 commit comments