File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ let headers = {
88async function getRepos ( url ) {
99 try {
1010 const response = await fetch ( url , { headers } ) ;
11- if ( ! response . ok ) throw new Error ( "Failed to fetch repositories" ) ;
11+ if ( ! response . ok ) {
12+ const errorDetails = await response . text ( ) ; // Capture response body for detailed error logging
13+ throw new Error ( `Failed to fetch repositories ${ url } - Status: ${ response . status } - Response: ${ errorDetails } ` ) ;
14+ }
1215 const repos = await response . json ( ) ;
1316 return repos . map ( repo => ( {
1417 name : repo . name ,
@@ -30,7 +33,10 @@ async function appendRepoContributers(repos) {
3033 if ( repo . contributors_url ) {
3134 try {
3235 const contributorsResponse = await fetch ( repo . contributors_url ) ;
33- if ( ! contributorsResponse . ok ) throw new Error ( "Failed to fetch contributors" ) ;
36+ if ( ! contributorsResponse . ok ) {
37+ const errorDetails = await contributorsResponse . text ( ) ;
38+ throw new Error ( `Failed to fetch contributors for ${ repo . name } - Status: ${ contributorsResponse . status } - Response: ${ errorDetails } ` ) ;
39+ }
3440 repo . contributorsList = ( await contributorsResponse . json ( ) )
3541 . map ( contributor => ( {
3642 avatar_url : contributor . avatar_url ,
You can’t perform that action at this time.
0 commit comments