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> {
604604
605605/** Check if class `cls` is Deployed in using server connection `api`. */
606606export 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+ ) ;
612615}
613616
614617// ---------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments