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'
99import { fromString } from './providers/credentials'
1010import { initializeCredentialsProviderManager } from './utils'
1111import { isAmazonQ , isSageMaker } from '../shared/extensionUtilities'
12+ import { getLogger } from '../shared/logger/logger'
13+ import { getErrorMsg } from '../shared/errors'
1214
1315interface SagemakerCookie {
1416 authMode ?: 'Sso' | 'Iam'
1517}
1618
1719export async function initialize ( loginManager : LoginManager ) : Promise < void > {
1820 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+ }
2334 }
2435 }
2536 Auth . instance . onDidChangeActiveConnection ( async ( conn ) => {
You can’t perform that action at this time.
0 commit comments