This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed
Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ async Task<Repository> GetRepositoryInternal()
7474 catch ( ApiException apiex )
7575 {
7676 if ( ! HostAddress . IsGitHubDotComUri ( OriginalUrl . ToRepositoryUrl ( ) ) )
77- isEnterprise = apiex . HttpResponse ? . Headers . ContainsKey ( "X-GitHub-Request-Id" ) ;
77+ isEnterprise = apiex . IsGitHubApiException ( ) ;
7878 }
7979 catch { }
8080 finally
Original file line number Diff line number Diff line change 1+ using System ;
2+ using Octokit ;
3+
4+ namespace GitHub . Extensions
5+ {
6+ public static class ApiExceptionExtensions
7+ {
8+ const string GithubHeader = "X-GitHub-Request-Id" ;
9+ public static bool IsGitHubApiException ( this Exception ex )
10+ {
11+ var apiex = ex as ApiException ;
12+ return apiex ? . HttpResponse ? . Headers . ContainsKey ( GithubHeader ) ?? false ;
13+ }
14+ }
15+ }
Original file line number Diff line number Diff line change 9797 <Link >Key.snk</Link >
9898 </None >
9999 <Compile Include =" Collections\ICopyable.cs" />
100+ <Compile Include =" ExceptionExtensions.cs" />
100101 <Compile Include =" Helpers\INotifyPropertySource.cs" />
101102 <Compile Include =" Extensions\PropertyNotifierExtensions.cs" />
102103 <Compile Include =" Extensions\SimpleRepositoryModelExtensions.cs" />
Original file line number Diff line number Diff line change @@ -41,9 +41,7 @@ public async Task<EnterpriseProbeResult> ProbeAsync(Uri enterpriseBaseUrl)
4141 var ret = await httpClient
4242 . Send ( request , CancellationToken . None )
4343 . Catch ( ex => {
44- var apiex = ex as ApiException ;
45- if ( apiex != null )
46- success = apiex . HttpResponse ? . Headers . ContainsKey ( "X-GitHub-Request-Id" ) ?? false ;
44+ success = ex . IsGitHubApiException ( ) ;
4745 return null ;
4846 } ) ;
4947
You can’t perform that action at this time.
0 commit comments