@@ -364,7 +364,13 @@ async function runBrowserHandoff(
364364 directory : string ,
365365) : Promise < void > {
366366 // The account this bind acts as; the seed refuses (account-changed) if it switches mid-way.
367- const linkAccount = ( await accountDigest ( ) ) ?? undefined
367+ // Unreadable credentials cannot link anyway, and must not leave the bind unguarded.
368+ const linkAccount = await accountDigest ( )
369+ if ( linkAccount === null ) {
370+ prompts . log . error ( "Could not read your Altimate credentials, so nothing was linked. Check /connect and try again." )
371+ process . exitCode = 1
372+ return
373+ }
368374 const spin = prompts . spinner ( )
369375 spin . start ( "Waiting for browser approval (up to 15 min)..." )
370376 const result : HandoffResult = await openWorkspaceBrowserHandoff ( { identifier, projectName } )
@@ -495,7 +501,13 @@ export async function createThenBindOrRebind(
495501 existing : ProjectBindingLookup | null ,
496502) : Promise < void > {
497503 // The account this bind acts as; the seed refuses (account-changed) if it switches mid-way.
498- const linkAccount = ( await accountDigest ( ) ) ?? undefined
504+ // Unreadable credentials cannot link anyway, and must not leave the bind unguarded.
505+ const linkAccount = await accountDigest ( )
506+ if ( linkAccount === null ) {
507+ prompts . log . error ( "Could not read your Altimate credentials, so nothing was linked. Check /connect and try again." )
508+ process . exitCode = 1
509+ return
510+ }
499511 const spin = prompts . spinner ( )
500512 spin . start ( `Creating workspace "${ name } "...` )
501513 // Discriminated on how the workspace was made, because the two creates return
@@ -667,7 +679,13 @@ async function bindOrRebind(
667679 directory : string ,
668680) : Promise < void > {
669681 // The account this bind acts as; the seed refuses (account-changed) if it switches mid-way.
670- const linkAccount = ( await accountDigest ( ) ) ?? undefined
682+ // Unreadable credentials cannot link anyway, and must not leave the bind unguarded.
683+ const linkAccount = await accountDigest ( )
684+ if ( linkAccount === null ) {
685+ prompts . log . error ( "Could not read your Altimate credentials, so nothing was linked. Check /connect and try again." )
686+ process . exitCode = 1
687+ return
688+ }
671689 const isRebind = existing !== null
672690 const spin = prompts . spinner ( )
673691 spin . start ( isRebind ? `Re-linking to workspace...` : `Linking to workspace...` )
0 commit comments