@@ -219,25 +219,31 @@ export async function getGitHubVersionFromApi(
219219 return { type : GitHubVariant . DOTCOM } ;
220220 }
221221
222- // Doesn't strictly have to be the meta endpoint as we're only
223- // using the response headers which are available on every request.
224- //
225- // See https://docs.github.com/en/rest/meta/meta#get-github-meta-information.
226- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
227- const response = await apiClient . rest . meta . get ( ) ;
228-
229- // This happens on dotcom, although we expect to have already returned in that
230- // case. This can also serve as a fallback in cases we haven't foreseen.
231- if ( response . headers [ GITHUB_ENTERPRISE_VERSION_HEADER ] === undefined ) {
232- return { type : GitHubVariant . DOTCOM } ;
233- }
222+ try {
223+ // Doesn't strictly have to be the meta endpoint as we're only
224+ // using the response headers which are available on every request.
225+ //
226+ // See https://docs.github.com/en/rest/meta/meta#get-github-meta-information.
227+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
228+ const response = await apiClient . rest . meta . get ( ) ;
229+
230+ // This happens on dotcom, although we expect to have already returned in that
231+ // case. This can also serve as a fallback in cases we haven't foreseen.
232+ if ( response . headers [ GITHUB_ENTERPRISE_VERSION_HEADER ] === undefined ) {
233+ return { type : GitHubVariant . DOTCOM } ;
234+ }
234235
235- if ( response . headers [ GITHUB_ENTERPRISE_VERSION_HEADER ] === "ghe.com" ) {
236- return { type : GitHubVariant . GHEC_DR } ;
237- }
236+ if ( response . headers [ GITHUB_ENTERPRISE_VERSION_HEADER ] === "ghe.com" ) {
237+ return { type : GitHubVariant . GHEC_DR } ;
238+ }
238239
239- const version = response . headers [ GITHUB_ENTERPRISE_VERSION_HEADER ] as string ;
240- return { type : GitHubVariant . GHES , version } ;
240+ const version = response . headers [
241+ GITHUB_ENTERPRISE_VERSION_HEADER
242+ ] as string ;
243+ return { type : GitHubVariant . GHES , version } ;
244+ } catch ( err ) {
245+ throw wrapApiConfigurationError ( err ) ;
246+ }
241247}
242248
243249/**
0 commit comments