File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
components/server/ee/src/user Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -93,22 +93,26 @@ export class EligibilityService {
9393 return { student : false , faculty : false } ;
9494 }
9595
96+ const logCtx = { userId : user . id } ;
9697 try {
9798 const rawResponse = await fetch ( "https://education.github.com/api/user" , {
9899 headers : {
99100 "Authorization" : `token ${ token } ` ,
100101 "faculty-check-preview" : "true"
101102 }
102103 } ) ;
104+ if ( ! rawResponse . ok ) {
105+ log . warn ( logCtx , `fetching the GitHub Education API failed with status ${ rawResponse . status } : ${ rawResponse . statusText } ` ) ;
106+ }
103107 const result : GitHubEducationPack = JSON . parse ( await rawResponse . text ( ) ) ;
104108 if ( result . student && result . faculty ) {
105109 // That violates the API contract: `student` and `faculty` need to be mutually exclusive
106- log . warn ( { userId : user . id } , "result of GitHub Eduction API violates the API contract: student and faculty need to be mutually exclusive" , result ) ;
110+ log . warn ( logCtx , "result of GitHub Eduction API violates the API contract: student and faculty need to be mutually exclusive" , result ) ;
107111 return { student : false , faculty : false } ;
108112 }
109113 return result ;
110114 } catch ( err ) {
111- log . warn ( { userId : user . id } , "error while checking student pack status" , err ) ;
115+ log . warn ( logCtx , "error while checking student pack status" , err ) ;
112116 }
113117 return { student : false , faculty : false } ;
114118 }
You can’t perform that action at this time.
0 commit comments