MOBILE-4470 contentlinks: Ignore errors calling getActions
This commit is contained in:
		
							parent
							
								
									023db99e2b
								
							
						
					
					
						commit
						b26ed5a25e
					
				@ -194,7 +194,10 @@ export class CoreContentLinksDelegateService {
 | 
				
			|||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                const actions = await handler.getActions(siteIds, relativeUrl, params, courseId, data);
 | 
					                const actions = await CoreUtils.ignoreErrors(
 | 
				
			||||||
 | 
					                    Promise.resolve(handler.getActions(siteIds, relativeUrl, params, courseId, data)),
 | 
				
			||||||
 | 
					                    <CoreContentLinksAction[]> [],
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                if (actions && actions.length) {
 | 
					                if (actions && actions.length) {
 | 
				
			||||||
                    // Set default values if any value isn't supplied.
 | 
					                    // Set default values if any value isn't supplied.
 | 
				
			||||||
 | 
				
			|||||||
@ -47,7 +47,6 @@ export class CoreCoursesSectionLinkHandlerService extends CoreCoursesLinksHandle
 | 
				
			|||||||
        url: string,
 | 
					        url: string,
 | 
				
			||||||
        params: Record<string, string>,
 | 
					        params: Record<string, string>,
 | 
				
			||||||
    ): Promise<CoreContentLinksAction[]> {
 | 
					    ): Promise<CoreContentLinksAction[]> {
 | 
				
			||||||
        try {
 | 
					 | 
				
			||||||
        const siteId = siteIds[0] ?? false;
 | 
					        const siteId = siteIds[0] ?? false;
 | 
				
			||||||
        const sectionId = params.id ? Number(params.id) : false;
 | 
					        const sectionId = params.id ? Number(params.id) : false;
 | 
				
			||||||
        const siteHomeId = await CoreSites.getSiteHomeId(siteId);
 | 
					        const siteHomeId = await CoreSites.getSiteHomeId(siteId);
 | 
				
			||||||
@ -58,11 +57,6 @@ export class CoreCoursesSectionLinkHandlerService extends CoreCoursesLinksHandle
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return this.getCourseActions(url, course.id, { sectionId });
 | 
					        return this.getCourseActions(url, course.id, { sectionId });
 | 
				
			||||||
        } catch (error) {
 | 
					 | 
				
			||||||
            this.logger.error(`Failed getting actions for url: '${url}'`, error);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            return [];
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user