diff --git a/src/core/classes/errors/ajaxwserror.ts b/src/core/classes/errors/ajaxwserror.ts index b21eedd1b..5a114f033 100644 --- a/src/core/classes/errors/ajaxwserror.ts +++ b/src/core/classes/errors/ajaxwserror.ts @@ -30,7 +30,7 @@ export class CoreAjaxWSError extends CoreError { // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(error: any, available?: number) { - super(error.message); + super(error.message || error.error); this.exception = error.exception; this.errorcode = error.errorcode; diff --git a/src/core/services/sites.ts b/src/core/services/sites.ts index c7cc2ba8e..280e518a3 100644 --- a/src/core/services/sites.ts +++ b/src/core/services/sites.ts @@ -338,12 +338,15 @@ export class CoreSitesProvider { } // Service supported but an error happened. Return error. + let critical = true; + if (error.errorcode === 'codingerror') { // This could be caused by a redirect. Check if it's the case. const redirect = await CoreUtils.checkRedirect(siteUrl); if (redirect) { error.message = Translate.instant('core.login.sitehasredirect'); + critical = false; // Keep checking fallback URLs. } else { // We can't be sure if there is a redirect or not. Display cannot connect error. error.message = Translate.instant('core.cannotconnecttrouble'); @@ -351,12 +354,14 @@ export class CoreSitesProvider { } else if (error.errorcode === 'invalidrecord') { // WebService not found, site not supported. error.message = Translate.instant('core.login.invalidmoodleversion', { $a: CoreSite.MINIMUM_MOODLE_VERSION }); + } else if (error.errorcode === 'redirecterrordetected') { + critical = false; // Keep checking fallback URLs. } return new CoreSiteError({ message: error.message, errorcode: error.errorcode, - critical: true, + critical, }); }