diff --git a/src/core/directives/link.ts b/src/core/directives/link.ts
index fc1d70a4b..02380e6f2 100644
--- a/src/core/directives/link.ts
+++ b/src/core/directives/link.ts
@@ -140,7 +140,7 @@ export class CoreLinkDirective implements OnInit {
try {
await CoreCustomURLSchemes.handleCustomURL(href);
} catch (error) {
- CoreCustomURLSchemes.treatHandleCustomURLError(error);
+ CoreCustomURLSchemes.treatHandleCustomURLError(error, href, 'CoreLinkDirective');
}
return;
diff --git a/src/core/features/login/pages/site/site.ts b/src/core/features/login/pages/site/site.ts
index a454bd12e..71051aa74 100644
--- a/src/core/features/login/pages/site/site.ts
+++ b/src/core/features/login/pages/site/site.ts
@@ -564,7 +564,7 @@ export class CoreLoginSitePage implements OnInit {
// An error ocurred, but it's an authentication URL and we have the site URL.
this.treatErrorInAuthenticationCustomURL(text, error);
} else {
- CoreCustomURLSchemes.treatHandleCustomURLError(error);
+ CoreCustomURLSchemes.treatHandleCustomURLError(error, text, 'CoreLoginSitePage');
}
}
@@ -630,7 +630,7 @@ export class CoreLoginSitePage implements OnInit {
'
' + Translate.instant('core.login.youcanstillconnectwithcredentials'),
);
- CoreCustomURLSchemes.treatHandleCustomURLError(error);
+ CoreCustomURLSchemes.treatHandleCustomURLError(error, customURL, 'CoreLoginSitePage');
}
/**
diff --git a/src/core/initializers/initialize-urlscheme.ts b/src/core/initializers/initialize-urlscheme.ts
index 312d53c1f..7c457aef1 100644
--- a/src/core/initializers/initialize-urlscheme.ts
+++ b/src/core/initializers/initialize-urlscheme.ts
@@ -42,7 +42,7 @@ export default async function(): Promise {
CoreEvents.trigger(CoreEvents.APP_LAUNCHED_URL, { url });
CoreCustomURLSchemes.handleCustomURL(url).catch((error) => {
- CoreCustomURLSchemes.treatHandleCustomURLError(error);
+ CoreCustomURLSchemes.treatHandleCustomURLError(error, url, 'handleOpenURL');
});
});
};
diff --git a/src/core/initializers/prepare-inapp-browser.ts b/src/core/initializers/prepare-inapp-browser.ts
index 30ec93d55..720daaf46 100644
--- a/src/core/initializers/prepare-inapp-browser.ts
+++ b/src/core/initializers/prepare-inapp-browser.ts
@@ -41,7 +41,7 @@ export default function(): void {
if (CoreCustomURLSchemes.isCustomURL(url)) {
// Close the browser if it's a valid SSO URL.
CoreCustomURLSchemes.handleCustomURL(url).catch((error) => {
- CoreCustomURLSchemes.treatHandleCustomURLError(error);
+ CoreCustomURLSchemes.treatHandleCustomURLError(error, url, 'InAppBrowser');
});
CoreOpener.closeInAppBrowser();
diff --git a/src/core/services/qrscan.ts b/src/core/services/qrscan.ts
index 257781624..c4699e1b4 100644
--- a/src/core/services/qrscan.ts
+++ b/src/core/services/qrscan.ts
@@ -77,7 +77,7 @@ export class CoreQRScanService {
try {
await CoreCustomURLSchemes.handleCustomURL(text);
} catch (error) {
- CoreCustomURLSchemes.treatHandleCustomURLError(error);
+ CoreCustomURLSchemes.treatHandleCustomURLError(error, text, 'CoreQRScanService');
}
return;
diff --git a/src/core/services/urlschemes.ts b/src/core/services/urlschemes.ts
index 22d876bf8..05b4cca6a 100644
--- a/src/core/services/urlschemes.ts
+++ b/src/core/services/urlschemes.ts
@@ -520,8 +520,10 @@ export class CoreCustomURLSchemesProvider {
* Treat error returned by handleCustomURL.
*
* @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') {
// Duplicated request
} else if (CoreWSError.isWebServiceError(error.error) && error.data && error.data.isSSOToken) {
@@ -531,7 +533,7 @@ export class CoreCustomURLSchemesProvider {
} else {
CoreDomUtils.showErrorModal(error.error ?? new CoreError(Translate.instant('core.login.invalidsite'), { debug: {
code: 'unknownerror',
- details: 'Unknown error when treating a URL scheme.',
+ details: `Unknown error when treating a URL scheme.
Origin: ${origin}.
URL: ${url}.`,
} }));
}
}