Merge pull request #3157 from dpalou/MOBILE-3833
MOBILE-3833 core: Decrease priority of redirect errorsmain
commit
e61d927837
|
@ -30,7 +30,7 @@ export class CoreAjaxWSError extends CoreError {
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
constructor(error: any, available?: number) {
|
constructor(error: any, available?: number) {
|
||||||
super(error.message);
|
super(error.message || error.error);
|
||||||
|
|
||||||
this.exception = error.exception;
|
this.exception = error.exception;
|
||||||
this.errorcode = error.errorcode;
|
this.errorcode = error.errorcode;
|
||||||
|
|
|
@ -338,12 +338,15 @@ export class CoreSitesProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Service supported but an error happened. Return error.
|
// Service supported but an error happened. Return error.
|
||||||
|
let critical = true;
|
||||||
|
|
||||||
if (error.errorcode === 'codingerror') {
|
if (error.errorcode === 'codingerror') {
|
||||||
// This could be caused by a redirect. Check if it's the case.
|
// This could be caused by a redirect. Check if it's the case.
|
||||||
const redirect = await CoreUtils.checkRedirect(siteUrl);
|
const redirect = await CoreUtils.checkRedirect(siteUrl);
|
||||||
|
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
error.message = Translate.instant('core.login.sitehasredirect');
|
error.message = Translate.instant('core.login.sitehasredirect');
|
||||||
|
critical = false; // Keep checking fallback URLs.
|
||||||
} else {
|
} else {
|
||||||
// We can't be sure if there is a redirect or not. Display cannot connect error.
|
// We can't be sure if there is a redirect or not. Display cannot connect error.
|
||||||
error.message = Translate.instant('core.cannotconnecttrouble');
|
error.message = Translate.instant('core.cannotconnecttrouble');
|
||||||
|
@ -351,12 +354,14 @@ export class CoreSitesProvider {
|
||||||
} else if (error.errorcode === 'invalidrecord') {
|
} else if (error.errorcode === 'invalidrecord') {
|
||||||
// WebService not found, site not supported.
|
// WebService not found, site not supported.
|
||||||
error.message = Translate.instant('core.login.invalidmoodleversion', { $a: CoreSite.MINIMUM_MOODLE_VERSION });
|
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({
|
return new CoreSiteError({
|
||||||
message: error.message,
|
message: error.message,
|
||||||
errorcode: error.errorcode,
|
errorcode: error.errorcode,
|
||||||
critical: true,
|
critical,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue