@@ -32,7 +32,7 @@ export async function getSessionList(channel: vscode.OutputChannel): Promise<ISe
3232}
3333
3434export 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 ) ) ;
3636if ( ! choice || choice . description === "Active" ) {
3737return ;
3838}
@@ -49,21 +49,26 @@ export async function selectSession(channel: vscode.OutputChannel): Promise<void
4949}
5050}
5151
52- async function parseSessionsToPicks ( p : Promise < ISession [ ] > ) :Promise < Array < IQuickItemEx < string > > > {
52+ async function parseSessionsToPicks ( channel : vscode . OutputChannel ) :Promise < Array < IQuickItemEx < string > > > {
5353return 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+ }
6772} ) ;
6873}
6974