@@ -217,10 +217,14 @@ func (impl *AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter
217217
218218 if string (appListingFilter .SortBy ) == helper .LastDeployedSortBy {
219219
220- query , queryParams := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForLastDeployedSearch (appListingFilter )
220+ query , queryParams , err := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForLastDeployedSearch (appListingFilter )
221+ if err != nil {
222+ impl .Logger .Errorw ("error in building appIds query with appList filter" , "err" , err , "filter" , appListingFilter )
223+ return appEnvArr , appsSize , err
224+ }
221225 impl .Logger .Debug ("GetAppIdsQueryWithPaginationForLastDeployedSearch query " , query )
222226 start := time .Now ()
223- _ , err : = impl .dbConnection .Query (& lastDeployedTimeDTO , query , queryParams ... )
227+ _ , err = impl .dbConnection .Query (& lastDeployedTimeDTO , query , queryParams ... )
224228 middleware .AppListingDuration .WithLabelValues ("getAppIdsQueryWithPaginationForLastDeployedSearch" , "devtron" ).Observe (time .Since (start ).Seconds ())
225229 if err != nil || len (lastDeployedTimeDTO ) == 0 {
226230 if err != nil {
@@ -235,7 +239,11 @@ func (impl *AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter
235239 appIdsFound [i ] = obj .AppId
236240 }
237241 appListingFilter .AppIds = appIdsFound
238- appContainerQuery , appContainerQueryParams := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainers (appListingFilter )
242+ appContainerQuery , appContainerQueryParams , err := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainers (appListingFilter )
243+ if err != nil {
244+ impl .Logger .Errorw ("error in building appEnv query with appList filter" , "err" , err , "filter" , appListingFilter )
245+ return appEnvArr , appsSize , err
246+ }
239247 impl .Logger .Debug ("GetQueryForAppEnvContainers query " , query )
240248 _ , err = impl .dbConnection .Query (& appEnvContainer , appContainerQuery , appContainerQueryParams ... )
241249 if err != nil {
@@ -247,10 +255,14 @@ func (impl *AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter
247255
248256 // to get all the appIds in appEnvs allowed for user and filtered by the appListing filter and sorted by name
249257 appIdCountDtos := make ([]* AppView.AppEnvironmentContainer , 0 )
250- appIdCountQuery , appIdCountQueryParams := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForAppNameSearch (appListingFilter )
258+ appIdCountQuery , appIdCountQueryParams , appsErr := impl .appListingRepositoryQueryBuilder .GetAppIdsQueryWithPaginationForAppNameSearch (appListingFilter )
259+ if appsErr != nil {
260+ impl .Logger .Errorw ("error in building appIds query with appList filter" , "err" , appsErr , "filter" , appListingFilter )
261+ return appEnvContainer , appsSize , appsErr
262+ }
251263 impl .Logger .Debug ("GetAppIdsQueryWithPaginationForAppNameSearch query " , appIdCountQuery )
252264 start := time .Now ()
253- _ , appsErr : = impl .dbConnection .Query (& appIdCountDtos , appIdCountQuery , appIdCountQueryParams ... )
265+ _ , appsErr = impl .dbConnection .Query (& appIdCountDtos , appIdCountQuery , appIdCountQueryParams ... )
254266 middleware .AppListingDuration .WithLabelValues ("getAppIdsQueryWithPaginationForAppNameSearch" , "devtron" ).Observe (time .Since (start ).Seconds ())
255267 if appsErr != nil || len (appIdCountDtos ) == 0 {
256268 if appsErr != nil {
@@ -268,7 +280,11 @@ func (impl *AppListingRepositoryImpl) FetchAppsByEnvironmentV2(appListingFilter
268280 appListingFilter .AppIds = uniqueAppIds
269281 // set appids required for this page in the filter and get the appEnv containers of these apps
270282 appListingFilter .AppIds = uniqueAppIds
271- appsEnvquery , appsEnvQueryParams := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainers (appListingFilter )
283+ appsEnvquery , appsEnvQueryParams , appsErr := impl .appListingRepositoryQueryBuilder .GetQueryForAppEnvContainers (appListingFilter )
284+ if appsErr != nil {
285+ impl .Logger .Errorw ("error in building appEnv query with appList filter" , "err" , appsErr , "filter" , appListingFilter )
286+ return appEnvContainer , appsSize , appsErr
287+ }
272288 impl .Logger .Debug ("GetQueryForAppEnvContainers query: " , appsEnvquery )
273289 start = time .Now ()
274290 _ , appsErr = impl .dbConnection .Query (& appEnvContainer , appsEnvquery , appsEnvQueryParams ... )
0 commit comments