@@ -18,6 +18,7 @@ import { CoreMainMenuHomeHandler, CoreMainMenuHomeHandlerToDisplay } from '@feat
1818import { CoreSites } from '@services/sites' ;
1919import { CoreUtils } from '@services/utils/utils' ;
2020import { makeSingleton } from '@singletons' ;
21+ import { CoreLogger } from '@singletons/logger' ;
2122import { CoreCoursesDashboard } from '../dashboard' ;
2223
2324/**
@@ -30,6 +31,11 @@ export class CoreDashboardHomeHandlerService implements CoreMainMenuHomeHandler
3031
3132 name = 'CoreCoursesDashboard' ;
3233 priority = 1200 ;
34+ logger : CoreLogger ;
35+
36+ constructor ( ) {
37+ this . logger = CoreLogger . getInstance ( 'CoreDashboardHomeHandlerService' ) ;
38+ }
3339
3440 /**
3541 * Check if the handler is enabled on a site level.
@@ -59,9 +65,17 @@ export class CoreDashboardHomeHandlerService implements CoreMainMenuHomeHandler
5965 const dashboardEnabled = ! dashboardDisabled && dashboardConfig !== '0' ;
6066
6167 if ( dashboardAvailable && dashboardEnabled && ! blocksDisabled ) {
62- const blocks = await CoreCoursesDashboard . getDashboardBlocks ( undefined , siteId ) ;
68+ try {
69+ const blocks = await CoreCoursesDashboard . getDashboardBlocks ( undefined , siteId ) ;
70+
71+ return CoreBlockDelegate . hasSupportedBlock ( blocks . mainBlocks ) ||
72+ CoreBlockDelegate . hasSupportedBlock ( blocks . sideBlocks ) ;
73+ } catch ( error ) {
74+ // Error getting blocks, assume it's enabled.
75+ this . logger . error ( 'Error getting Dashboard blocks' , error ) ;
6376
64- return CoreBlockDelegate . hasSupportedBlock ( blocks . mainBlocks ) || CoreBlockDelegate . hasSupportedBlock ( blocks . sideBlocks ) ;
77+ return true ;
78+ }
6579 }
6680
6781 // Dashboard is enabled but not available, we will fake blocks.
0 commit comments