Skip to content

Commit

Permalink
fix(angular): throw error when no parent module found (#16728)
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 authored May 3, 2023
1 parent 6c221ea commit c2e88ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/angular/src/generators/component/lib/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function findModule(
tree: Tree,
generateDir: string,
projectRoot: string
): string | null {
): string {
let dir = generateDir;
const projectRootParent = dirname(projectRoot);

Expand All @@ -80,5 +80,7 @@ function findModule(
dir = dirname(dir);
}

return null;
throw new Error(
"Could not find a candidate module to add the component to. Please specify which module the component should be added to by using the '--module' option."
);
}

0 comments on commit c2e88ad

Please sign in to comment.