@@ -200,37 +200,30 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
200200 try {
201201 await remote . setup ( vscodeProposed . env . remoteAuthority )
202202 } catch ( ex ) {
203- switch ( true ) {
204- case ex instanceof CertificateError :
205- await ex . showModal ( "Failed to open workspace" )
206- break
207- case isAxiosError ( ex ) :
208- {
209- const msg = getErrorMessage ( ex , "" )
210- const detail = getErrorDetail ( ex )
211- const urlString = axios . getUri ( ex . response ?. config )
212- let path = urlString
213- try {
214- path = new URL ( urlString ) . pathname
215- } catch ( e ) {
216- // ignore, default to full url
217- }
218-
219- await vscodeProposed . window . showErrorMessage ( "Failed to open workspace" , {
220- detail : `API ${ ex . response ?. config . method ?. toUpperCase ( ) } to '${ path } ' failed with code ${ ex . response ?. status } .\nMessage: ${ msg } \nDetail: ${ detail } ` ,
221- modal : true ,
222- useCustom : true ,
223- } )
224- }
225- break
226- default :
227- await vscodeProposed . window . showErrorMessage ( "Failed to open workspace" , {
228- detail : ( ex as string ) . toString ( ) ,
229- modal : true ,
230- useCustom : true ,
231- } )
203+ if ( ex instanceof CertificateError ) {
204+ await ex . showModal ( "Failed to open workspace" )
205+ } else if ( isAxiosError ( ex ) ) {
206+ const msg = getErrorMessage ( ex , "" )
207+ const detail = getErrorDetail ( ex )
208+ const urlString = axios . getUri ( ex . response ?. config )
209+ let path = urlString
210+ try {
211+ path = new URL ( urlString ) . pathname
212+ } catch ( e ) {
213+ // ignore, default to full url
214+ }
215+ await vscodeProposed . window . showErrorMessage ( "Failed to open workspace" , {
216+ detail : `API ${ ex . response ?. config . method ?. toUpperCase ( ) } to '${ path } ' failed with code ${ ex . response ?. status } .\nMessage: ${ msg } \nDetail: ${ detail } ` ,
217+ modal : true ,
218+ useCustom : true ,
219+ } )
220+ } else {
221+ await vscodeProposed . window . showErrorMessage ( "Failed to open workspace" , {
222+ detail : ( ex as string ) . toString ( ) ,
223+ modal : true ,
224+ useCustom : true ,
225+ } )
232226 }
233-
234227 // Always close remote session when we fail to open a workspace.
235228 await remote . closeRemote ( )
236229 }
0 commit comments