File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -604,11 +604,14 @@ export async function fileExists(file: vscode.Uri): Promise<boolean> {
604
604
605
605
/** Check if class `cls` is Deployed in using server connection `api`. */
606
606
export async function isClassDeployed ( cls : string , api : AtelierAPI ) : Promise < boolean > {
607
- return api
608
- . actionQuery ( "SELECT Deployed FROM %Dictionary.ClassDefinition WHERE Name = ?" , [
609
- cls . slice ( - 4 ) . toLowerCase ( ) == ".cls" ? cls . slice ( 0 , - 4 ) : cls ,
610
- ] )
611
- . then ( ( data ) => data . result . content [ 0 ] ?. Deployed > 0 ) ;
607
+ const clsname = cls . slice ( - 4 ) . toLowerCase ( ) == ".cls" ? cls . slice ( 0 , - 4 ) : cls ;
608
+ return (
609
+ api
610
+ . actionQuery ( "SELECT Deployed FROM %Dictionary.ClassDefinition WHERE Name = ?" , [ clsname ] )
611
+ . then ( ( data ) => data . result . content [ 0 ] ?. Deployed > 0 )
612
+ // Query failure is probably due to a permissions error, so fall back to index
613
+ . catch ( ( ) => api . actionIndex ( [ `${ clsname } .cls` ] ) . then ( ( data ) => data . result . content [ 0 ] . content ?. depl ?? false ) )
614
+ ) ;
612
615
}
613
616
614
617
// ---------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments