MOBILE-4577 courses: Ignore missing cache errors
parent
86f53ba3ec
commit
f707de547d
|
@ -20,6 +20,7 @@ import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
|
||||||
import { CoreCourse } from '@features/course/services/course';
|
import { CoreCourse } from '@features/course/services/course';
|
||||||
import { CoreCoursesLinksHandlerBase } from '@features/courses/services/handlers/base-link-handler';
|
import { CoreCoursesLinksHandlerBase } from '@features/courses/services/handlers/base-link-handler';
|
||||||
import { CoreLogger } from '@singletons/logger';
|
import { CoreLogger } from '@singletons/logger';
|
||||||
|
import { CoreUtils } from '@services/utils/utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to treat links to course section.
|
* Handler to treat links to course section.
|
||||||
|
@ -80,10 +81,12 @@ export class CoreCoursesSectionLinkHandlerService extends CoreCoursesLinksHandle
|
||||||
// Given that getting all the courses from a user could be very network intensive, all the requests
|
// Given that getting all the courses from a user could be very network intensive, all the requests
|
||||||
// in this method will only use cache.
|
// in this method will only use cache.
|
||||||
|
|
||||||
const courses = await CoreCourses.getUserCourses(true, siteId, CoreSitesReadingStrategy.ONLY_CACHE);
|
const courses = await CoreUtils.ignoreErrors(
|
||||||
|
CoreCourses.getUserCourses(true, siteId, CoreSitesReadingStrategy.ONLY_CACHE),
|
||||||
|
) ?? [];
|
||||||
|
|
||||||
for (const course of courses) {
|
for (const course of courses) {
|
||||||
const courseSections = await CoreCourse.getSections(
|
const courseSections = await CoreUtils.ignoreErrors(CoreCourse.getSections(
|
||||||
course.id,
|
course.id,
|
||||||
true,
|
true,
|
||||||
true,
|
true,
|
||||||
|
@ -91,9 +94,9 @@ export class CoreCoursesSectionLinkHandlerService extends CoreCoursesLinksHandle
|
||||||
...CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.ONLY_CACHE),
|
...CoreSites.getReadingStrategyPreSets(CoreSitesReadingStrategy.ONLY_CACHE),
|
||||||
getCacheUsingCacheKey: true,
|
getCacheUsingCacheKey: true,
|
||||||
},
|
},
|
||||||
);
|
));
|
||||||
|
|
||||||
const courseSection = courseSections.find(section => section.id === sectionId);
|
const courseSection = courseSections?.find(section => section.id === sectionId);
|
||||||
|
|
||||||
if (!courseSection) {
|
if (!courseSection) {
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue