@@ -345,16 +345,13 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
345345 logger . info ( `Using base interpreter: ${ getDisplayPath ( interpreter . uri ) } ` ) ;
346346
347347 // Ensure deepnote-toolkit is installed in a venv and get the venv interpreter
348+ // Will throw typed errors on failure (DeepnoteVenvCreationError or DeepnoteToolkitInstallError)
348349 progress . report ( { message : l10n . t ( 'Installing Deepnote toolkit...' ) } ) ;
349350 const venvInterpreter = await this . toolkitInstaller . ensureInstalled (
350351 interpreter ,
351352 baseFileUri ,
352353 progressToken
353354 ) ;
354- if ( ! venvInterpreter ) {
355- logger . error ( 'Failed to set up Deepnote toolkit environment' ) ;
356- return ; // Exit gracefully
357- }
358355
359356 logger . info ( `Deepnote toolkit venv ready at: ${ getDisplayPath ( venvInterpreter . uri ) } ` ) ;
360357
@@ -567,22 +564,32 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
567564 logger . error ( error . getErrorReport ( ) ) ;
568565
569566 // Show user-friendly error with actions
570- const actions : string [ ] = [ 'Show Output' , 'Copy Error Details' ] ;
567+ const showOutputAction = l10n . t ( 'Show Output' ) ;
568+ const copyErrorAction = l10n . t ( 'Copy Error Details' ) ;
569+ const actions : string [ ] = [ showOutputAction , copyErrorAction ] ;
570+
571+ const troubleshootingHeader = l10n . t ( 'Troubleshooting:' ) ;
572+ const troubleshootingSteps = error . troubleshootingSteps
573+ . slice ( 0 , 3 )
574+ . map ( ( step , i ) => `${ i + 1 } . ${ step } ` )
575+ . join ( '\n' ) ;
571576
572577 const selectedAction = await window . showErrorMessage (
573- `${ error . userMessage } \n\nTroubleshooting:\n${ error . troubleshootingSteps
574- . slice ( 0 , 3 )
575- . map ( ( step , i ) => `${ i + 1 } . ${ step } ` )
576- . join ( '\n' ) } `,
578+ `${ error . userMessage } \n\n${ troubleshootingHeader } \n${ troubleshootingSteps } ` ,
577579 { modal : false } ,
578580 ...actions
579581 ) ;
580582
581- if ( selectedAction === 'Show Output' ) {
583+ if ( selectedAction === showOutputAction ) {
582584 this . outputChannel . show ( ) ;
583- } else if ( selectedAction === 'Copy Error Details' ) {
584- await env . clipboard . writeText ( error . getErrorReport ( ) ) ;
585- void window . showInformationMessage ( 'Error details copied to clipboard' ) ;
585+ } else if ( selectedAction === copyErrorAction ) {
586+ try {
587+ await env . clipboard . writeText ( error . getErrorReport ( ) ) ;
588+ void window . showInformationMessage ( l10n . t ( 'Error details copied to clipboard' ) ) ;
589+ } catch ( clipboardError ) {
590+ logger . error ( 'Failed to copy error details to clipboard' , clipboardError ) ;
591+ void window . showErrorMessage ( l10n . t ( 'Failed to copy error details to clipboard' ) ) ;
592+ }
586593 }
587594
588595 return ;
@@ -592,13 +599,14 @@ export class DeepnoteKernelAutoSelector implements IDeepnoteKernelAutoSelector,
592599 const errorMessage = error instanceof Error ? error . message : String ( error ) ;
593600 logger . error ( `Deepnote kernel error: ${ errorMessage } ` ) ;
594601
602+ const showOutputAction = l10n . t ( 'Show Output' ) ;
595603 const selectedAction = await window . showErrorMessage (
596604 l10n . t ( 'Failed to load Deepnote kernel: {0}' , errorMessage ) ,
597605 { modal : false } ,
598- 'Show Output'
606+ showOutputAction
599607 ) ;
600608
601- if ( selectedAction === 'Show Output' ) {
609+ if ( selectedAction === showOutputAction ) {
602610 this . outputChannel . show ( ) ;
603611 }
604612 }
0 commit comments