Skip to content

Commit afa4afb

Browse files
committed
fix: better error messages when creating file
1 parent ab0efb3 commit afa4afb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/functions/CreateFileFromTemplate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ export async function CreateFileFromTemplate(
3636
}
3737

3838
if (!output || (component && (!output.config || !output.config.category))) {
39-
throw new Error('Invalid template.');
39+
throw new Error('The template is invalid. Please create a valid template structure.');
4040
}
4141

4242
const directoryForOutput = component ? config?.locations[output.config!.category] : null;
4343
const targetPath = component ? target.replace('%L%', directoryForOutput) : target;
4444

4545
if (await fileExists(targetPath)) {
46-
throw new Error('Component already exists');
46+
throw new Error('A component with the provided name already exists. Please provide a unique name.');
4747
}
4848

4949
await writeFileRecursive(targetPath, output.templateContent);

0 commit comments

Comments
 (0)