Skip to content

Commit 893a538

Browse files
committed
improve error handling
1 parent ac9717c commit 893a538

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/ui-cli/src/cli.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ export default function cli() {
1919

2020
const url = new URL(`r/${packageName}.json`, 'https://clerk.com');
2121

22-
execSync(`npx -y shadcn@latest add ${url.toString()}`);
22+
try {
23+
execSync(`npx -y shadcn@latest add ${url.toString()}`, { stdio: 'inherit' });
24+
} catch {
25+
console.error(`\nError: Failed to add component "${packageName}"`);
26+
console.error(`Could not fetch component from: ${url.toString()}`);
27+
console.error('Please ensure:');
28+
console.error(' - The component name is correct');
29+
console.error(' - You have internet connectivity');
30+
console.error(' - The component exists at the specified URL');
31+
process.exit(1);
32+
}
2333
}
2434
}

0 commit comments

Comments
 (0)