File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * Licensed under the MIT License. See License.txt in the project root for license information.
44 *--------------------------------------------------------------------------------------------*/
55
6+ import * as vscode from 'vscode' ;
7+
68export enum GitHubServerType {
79 None ,
810 GitHubDotCom ,
@@ -15,8 +17,8 @@ export enum AuthProvider {
1517}
1618
1719export class AuthenticationError extends Error {
18- constructor ( message : string ) {
19- super ( message ) ;
20+ constructor ( ) {
21+ super ( vscode . l10n . t ( 'Not authenticated' ) ) ;
2022 }
2123}
2224
Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ export class GitHubRepository extends Disposable {
157157 if ( ! this . _initialized ) {
158158 throw new Error ( 'Call ensure() before accessing this property.' ) ;
159159 } else {
160- throw new AuthenticationError ( 'Not authenticated.' ) ;
160+ throw new AuthenticationError ( ) ;
161161 }
162162 }
163163 return this . _hub ;
Original file line number Diff line number Diff line change 44 *--------------------------------------------------------------------------------------------*/
55
66import * as vscode from 'vscode' ;
7- import { AuthProvider } from '../../common/authentication' ;
7+ import { AuthenticationError , AuthProvider } from '../../common/authentication' ;
88import { CredentialStore , GitHub } from '../../github/credentials' ;
99import { FolderRepositoryManager } from '../../github/folderRepositoryManager' ;
1010import { RepositoriesManager } from '../../github/repositoriesManager' ;
@@ -55,6 +55,10 @@ export abstract class RepoToolBase<T> extends ToolBase<T> {
5555 }
5656
5757 protected async getRepoInfo ( options : { owner ?: string , name ?: string } ) : Promise < { owner : string ; name : string ; folderManager : FolderRepositoryManager } > {
58+ if ( ! this . credentialStore . isAnyAuthenticated ( ) ) {
59+ throw new AuthenticationError ( ) ;
60+ }
61+
5862 let owner : string | undefined ;
5963 let name : string | undefined ;
6064 let folderManager : FolderRepositoryManager | undefined ;
You can’t perform that action at this time.
0 commit comments