如何处理UI5一般性错误Cannot read property md of undefined

117 阅读1分钟

Suppose you have encountered with this error when you launch your Fiori application:
Uncaught Error: failed to load ‘FioriTest/view/Master.controller.js’ from ./view/Master.controller.js: TypeError: Cannot read property ‘md’ of undefined
The error is raised in framework file UIComponent-dbg.js. In most of the case the error is not in framework side, but due to wrong code in your own application code.

1). click the hyperlink:

2). You will be automatically navigated to the code where the exception - the error message is raised.
Set a breakpoint here:

3). re-launch your Fiori application, the breakpoint is triggered, you can then find the detail callstack by evaluating the variable e:

Search in Opportunity application, and we realized that there is a missing require statement:

after the require statement above is added, the error message changes:

so we are still lack of another necessary require statement, and this is the root cause of the error message. Once we add the missing require statement, issue will be resolved.

要获取更多Jerry的原创文章,请关注公众号"汪子熙":