magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.52k stars 9.31k forks source link

Better error message for knockoutjs parser / evaluation error #39257

Open webloft opened 1 week ago

webloft commented 1 week ago

Summary

If you have any error in your knockoutjs template you wont see the actual error given by the parser at loading the template, instead it just logs:

Failed to load the "module/components/whatever/path" template requested by "another module".

but the file can be loaded via network.

You need to intercept the Magento_Ui/js/lib/knockout/template/engine script at the point

consoleLogger.error('templateLoadingFail', {
   template: templateId,
   component: bindingContext.$data.name
});

and grab the first argument of the function to get the actual error.

You might still need the error in production mode, so it should be visible in the browsers console at any time.

Examples

-

Proposed solution

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 week ago

Hi @webloft. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce.

m2-assistant[bot] commented 1 week ago

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-November commented 1 week ago

Hello @webloft,

Thank you for the report and collaboration!

Going through the issue this can be marked as a feature request.