MOBILE-4470 contentlinks: Ignore errors calling getActions
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,22 +47,16 @@ 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);
|
const course = await this.getSectionCourse(sectionId, siteId);
|
||||||
const course = await this.getSectionCourse(sectionId, siteId);
|
|
||||||
|
|
||||||
if (!sectionId || !course || course.id === siteHomeId) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getCourseActions(url, course.id, { sectionId });
|
|
||||||
} catch (error) {
|
|
||||||
this.logger.error(`Failed getting actions for url: '${url}'`, error);
|
|
||||||
|
|
||||||
|
if (!sectionId || !course || course.id === siteHomeId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return this.getCourseActions(url, course.id, { sectionId });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue