MOBILE-4693 core: Display URL and origin for unknown url scheme errors
parent
988a5b6b39
commit
719424707b
|
@ -140,7 +140,7 @@ export class CoreLinkDirective implements OnInit {
|
||||||
try {
|
try {
|
||||||
await CoreCustomURLSchemes.handleCustomURL(href);
|
await CoreCustomURLSchemes.handleCustomURL(href);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreCustomURLSchemes.treatHandleCustomURLError(error);
|
CoreCustomURLSchemes.treatHandleCustomURLError(error, href, 'CoreLinkDirective');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -564,7 +564,7 @@ export class CoreLoginSitePage implements OnInit {
|
||||||
// An error ocurred, but it's an authentication URL and we have the site URL.
|
// An error ocurred, but it's an authentication URL and we have the site URL.
|
||||||
this.treatErrorInAuthenticationCustomURL(text, error);
|
this.treatErrorInAuthenticationCustomURL(text, error);
|
||||||
} else {
|
} else {
|
||||||
CoreCustomURLSchemes.treatHandleCustomURLError(error);
|
CoreCustomURLSchemes.treatHandleCustomURLError(error, text, 'CoreLoginSitePage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +630,7 @@ export class CoreLoginSitePage implements OnInit {
|
||||||
'<br><br>' + Translate.instant('core.login.youcanstillconnectwithcredentials'),
|
'<br><br>' + Translate.instant('core.login.youcanstillconnectwithcredentials'),
|
||||||
);
|
);
|
||||||
|
|
||||||
CoreCustomURLSchemes.treatHandleCustomURLError(error);
|
CoreCustomURLSchemes.treatHandleCustomURLError(error, customURL, 'CoreLoginSitePage');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,7 +42,7 @@ export default async function(): Promise<void> {
|
||||||
|
|
||||||
CoreEvents.trigger(CoreEvents.APP_LAUNCHED_URL, { url });
|
CoreEvents.trigger(CoreEvents.APP_LAUNCHED_URL, { url });
|
||||||
CoreCustomURLSchemes.handleCustomURL(url).catch((error) => {
|
CoreCustomURLSchemes.handleCustomURL(url).catch((error) => {
|
||||||
CoreCustomURLSchemes.treatHandleCustomURLError(error);
|
CoreCustomURLSchemes.treatHandleCustomURLError(error, url, 'handleOpenURL');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default function(): void {
|
||||||
if (CoreCustomURLSchemes.isCustomURL(url)) {
|
if (CoreCustomURLSchemes.isCustomURL(url)) {
|
||||||
// Close the browser if it's a valid SSO URL.
|
// Close the browser if it's a valid SSO URL.
|
||||||
CoreCustomURLSchemes.handleCustomURL(url).catch((error) => {
|
CoreCustomURLSchemes.handleCustomURL(url).catch((error) => {
|
||||||
CoreCustomURLSchemes.treatHandleCustomURLError(error);
|
CoreCustomURLSchemes.treatHandleCustomURLError(error, url, 'InAppBrowser');
|
||||||
});
|
});
|
||||||
CoreOpener.closeInAppBrowser();
|
CoreOpener.closeInAppBrowser();
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ export class CoreQRScanService {
|
||||||
try {
|
try {
|
||||||
await CoreCustomURLSchemes.handleCustomURL(text);
|
await CoreCustomURLSchemes.handleCustomURL(text);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
CoreCustomURLSchemes.treatHandleCustomURLError(error);
|
CoreCustomURLSchemes.treatHandleCustomURLError(error, text, 'CoreQRScanService');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -520,8 +520,10 @@ export class CoreCustomURLSchemesProvider {
|
||||||
* Treat error returned by handleCustomURL.
|
* Treat error returned by handleCustomURL.
|
||||||
*
|
*
|
||||||
* @param error Error data.
|
* @param error Error data.
|
||||||
|
* @param url The URL that caused the error.
|
||||||
|
* @param origin Origin of the treat handle error call.
|
||||||
*/
|
*/
|
||||||
treatHandleCustomURLError(error: CoreCustomURLSchemesHandleError): void {
|
treatHandleCustomURLError(error: CoreCustomURLSchemesHandleError, url = '', origin = 'unknown'): void {
|
||||||
if (error.error === 'Duplicated') {
|
if (error.error === 'Duplicated') {
|
||||||
// Duplicated request
|
// Duplicated request
|
||||||
} else if (CoreWSError.isWebServiceError(error.error) && error.data && error.data.isSSOToken) {
|
} else if (CoreWSError.isWebServiceError(error.error) && error.data && error.data.isSSOToken) {
|
||||||
|
@ -531,7 +533,7 @@ export class CoreCustomURLSchemesProvider {
|
||||||
} else {
|
} else {
|
||||||
CoreDomUtils.showErrorModal(error.error ?? new CoreError(Translate.instant('core.login.invalidsite'), { debug: {
|
CoreDomUtils.showErrorModal(error.error ?? new CoreError(Translate.instant('core.login.invalidsite'), { debug: {
|
||||||
code: 'unknownerror',
|
code: 'unknownerror',
|
||||||
details: 'Unknown error when treating a URL scheme.',
|
details: `Unknown error when treating a URL scheme.<br><br>Origin: ${origin}.<br><br>URL: ${url}.`,
|
||||||
} }));
|
} }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue