Merge pull request #3725 from NoelDeMartin/MOBILE-4341
MOBILE-4341 core: Ignore native error codes in webmain
commit
670bb10330
|
@ -512,6 +512,7 @@ export class CoreWSProvider {
|
||||||
supportConfig: await CoreUserGuestSupportConfig.forSite(preSets.siteUrl),
|
supportConfig: await CoreUserGuestSupportConfig.forSite(preSets.siteUrl),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (CorePlatform.isMobile()) {
|
||||||
switch (data.status) {
|
switch (data.status) {
|
||||||
case NativeHttp.ErrorCode.SSL_EXCEPTION:
|
case NativeHttp.ErrorCode.SSL_EXCEPTION:
|
||||||
options.errorcode = 'invalidcertificate';
|
options.errorcode = 'invalidcertificate';
|
||||||
|
@ -544,9 +545,16 @@ export class CoreWSProvider {
|
||||||
options.errorcode = 'requestprocessingfailed';
|
options.errorcode = 'requestprocessingfailed';
|
||||||
options.errorDetails = CoreTextUtils.getErrorMessageFromError(data.error) ?? 'Request processing failed';
|
options.errorDetails = CoreTextUtils.getErrorMessageFromError(data.error) ?? 'Request processing failed';
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!options.errorcode) {
|
||||||
|
switch (data.status) {
|
||||||
case 404:
|
case 404:
|
||||||
options.errorcode = 'endpointnotfound';
|
options.errorcode = 'endpointnotfound';
|
||||||
options.errorDetails = Translate.instant('core.ajaxendpointnotfound', { $a: CoreSite.MINIMUM_MOODLE_VERSION });
|
options.errorDetails = Translate.instant('core.ajaxendpointnotfound', {
|
||||||
|
$a: CoreSite.MINIMUM_MOODLE_VERSION,
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
const details = CoreTextUtils.getErrorMessageFromError(data.error) ?? 'Unknown error';
|
const details = CoreTextUtils.getErrorMessageFromError(data.error) ?? 'Unknown error';
|
||||||
|
@ -558,6 +566,7 @@ export class CoreWSProvider {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new CoreAjaxError(options, 1, data.status);
|
throw new CoreAjaxError(options, 1, data.status);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue