@@ -32,7 +32,7 @@ export async function getSessionList(channel: vscode.OutputChannel): Promise<ISe
32
32
}
33
33
34
34
export async function selectSession ( channel :vscode . OutputChannel ) :Promise < void > {
35
- const choice :IQuickItemEx < string > | undefined = await vscode . window . showQuickPick ( parseSessionsToPicks ( getSessionList ( channel ) ) ) ;
35
+ const choice :IQuickItemEx < string > | undefined = await vscode . window . showQuickPick ( parseSessionsToPicks ( channel ) ) ;
36
36
if ( ! choice || choice . description === "Active" ) {
37
37
return ;
38
38
}
@@ -49,21 +49,26 @@ export async function selectSession(channel: vscode.OutputChannel): Promise<void
49
49
}
50
50
}
51
51
52
- async function parseSessionsToPicks ( p : Promise < ISession [ ] > ) :Promise < Array < IQuickItemEx < string > > > {
52
+ async function parseSessionsToPicks ( channel : vscode . OutputChannel ) :Promise < Array < IQuickItemEx < string > > > {
53
53
return new Promise ( async ( resolve :( res :Array < IQuickItemEx < string > > ) => void ) :Promise < void > => {
54
- const picks :Array < IQuickItemEx < string > > = ( await p ) . map ( ( s :ISession ) => Object . assign ( { } , {
55
- label :`${ s . active ?"$(check) " :"" } ${ s . name } ` ,
56
- description :s . active ?"Active" :"" ,
57
- detail :`AC Questions:${ s . acQuestions } , AC Submits:${ s . acSubmits } ` ,
58
- value :s . id ,
59
- } ) ) ;
60
- picks . push ( {
61
- label :"$(plus) Create a new session" ,
62
- description :"" ,
63
- detail :"Click this item to create a new session" ,
64
- value :":createNewSession" ,
65
- } ) ;
66
- resolve ( picks ) ;
54
+ try {
55
+ const sessions :ISession [ ] = await getSessionList ( channel ) ;
56
+ const picks :Array < IQuickItemEx < string > > = sessions . map ( ( s :ISession ) => Object . assign ( { } , {
57
+ label :`${ s . active ?"$(check) " :"" } ${ s . name } ` ,
58
+ description :s . active ?"Active" :"" ,
59
+ detail :`AC Questions:${ s . acQuestions } , AC Submits:${ s . acSubmits } ` ,
60
+ value :s . id ,
61
+ } ) ) ;
62
+ picks . push ( {
63
+ label :"$(plus) Create a new session" ,
64
+ description :"" ,
65
+ detail :"Click this item to create a new session" ,
66
+ value :":createNewSession" ,
67
+ } ) ;
68
+ resolve ( picks ) ;
69
+ } catch ( error ) {
70
+ return await promptForOpenOutputChannel ( "Failed to list sessions. Please open the output channel for details" , DialogType . error , channel ) ;
71
+ }
67
72
} ) ;
68
73
}
69
74