File tree Expand file tree Collapse file tree
packages/shadcn/src/utils/registry Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ " shadcn " : patch
3+ ---
4+
5+ better error handling
Original file line number Diff line number Diff line change @@ -174,6 +174,31 @@ async function fetchRegistry(paths: string[]) {
174174 404 : "Not found" ,
175175 500 : "Internal server error" ,
176176 }
177+
178+ if ( response . status === 401 ) {
179+ throw new Error (
180+ `You are not authorized to access the component at ${ highlighter . info (
181+ url
182+ ) } .\nIf this is a remote registry, you may need to authenticate.`
183+ )
184+ }
185+
186+ if ( response . status === 404 ) {
187+ throw new Error (
188+ `The component at ${ highlighter . info (
189+ url
190+ ) } was not found.\nIt may not exist at the registry. Please make sure it is a valid component.`
191+ )
192+ }
193+
194+ if ( response . status === 403 ) {
195+ throw new Error (
196+ `You do not have access to the component at ${ highlighter . info (
197+ url
198+ ) } .\nIf this is a remote registry, you may need to authenticate or a token.`
199+ )
200+ }
201+
177202 const result = await response . json ( )
178203 const message =
179204 result && typeof result === "object" && "error" in result
You can’t perform that action at this time.
0 commit comments