File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,28 @@ import { LoginManager } from './deprecated/loginManager'
9
9
import { fromString } from './providers/credentials'
10
10
import { initializeCredentialsProviderManager } from './utils'
11
11
import { isAmazonQ , isSageMaker } from '../shared/extensionUtilities'
12
+ import { getLogger } from '../shared/logger/logger'
13
+ import { getErrorMsg } from '../shared/errors'
12
14
13
15
interface SagemakerCookie {
14
16
authMode ?: 'Sso' | 'Iam'
15
17
}
16
18
17
19
export async function initialize ( loginManager : LoginManager ) : Promise < void > {
18
20
if ( isAmazonQ ( ) && isSageMaker ( ) ) {
19
- // The command `sagemaker.parseCookies` is registered in VS Code Sagemaker environment.
20
- const result = ( await vscode . commands . executeCommand ( 'sagemaker.parseCookies' ) ) as SagemakerCookie
21
- if ( result . authMode !== 'Sso' ) {
22
- initializeCredentialsProviderManager ( )
21
+ try {
22
+ // The command `sagemaker.parseCookies` is registered in VS Code Sagemaker environment.
23
+ const result = ( await vscode . commands . executeCommand ( 'sagemaker.parseCookies' ) ) as SagemakerCookie
24
+ if ( result . authMode !== 'Sso' ) {
25
+ initializeCredentialsProviderManager ( )
26
+ }
27
+ } catch ( e ) {
28
+ const errMsg = getErrorMsg ( e as Error )
29
+ if ( errMsg ?. includes ( "command 'sagemaker.parseCookies' not found" ) ) {
30
+ getLogger ( ) . warn ( `Failed to execute command "sagemaker.parseCookies": ${ e } ` )
31
+ } else {
32
+ throw e
33
+ }
23
34
}
24
35
}
25
36
Auth . instance . onDidChangeActiveConnection ( async ( conn ) => {
You can’t perform that action at this time.
0 commit comments