How do you guys debug javascript errors in the browser console? - Mendix Forum

How do you guys debug javascript errors in the browser console?


When developing Mendix apps, you sometimes run into framework mxui.js errors being thrown in the console of your browser.

 at mxui.js?636808140464586025:7
    at Object.e.exports.collect (mxui.js?636808140464586025:7)
    at Object.e.exports.applyContext (mxui.js?636808140464586025:7)
    at N.(anonymous function).E.passContext (http://localhost:8080/mxclientsystem/mxui/mxui.js?636808140464586025:7:140970)
    at N.(anonymous function).E.applyContext (http://localhost:8080/mxclientsystem/mxui/mxui.js?636808140464586025:7:140855)
    at N.(anonymous function).E.<anonymous> (http://localhost:8080/mxclientsystem/mxui/mxui.js?636808140464586025:7:569166)
    at Object.e.exports.collect (mxui.js?636808140464586025:7)
    at N.(anonymous function).E.collect (http://localhost:8080/mxclientsystem/mxui/mxui.js?636808140464586025:7:141756)
    at N.(anonymous function).E._loadListItems (http://localhost:8080/mxclientsystem/mxui/mxui.js?636808140464586025:7:569052)
    at mxui.js?636808140464586025:7

And these kind of errors thrown are unreadable to me.

And it just tells the user in the interface to contact the helpdesk.

Reading the console error messages is extremely unclear due to the minimization of all Javascript and parameter names.

So I was wondering if anyone has some tips on how to resolve these kinds of errors.
How do I discover which objects/elements cause these interface errors?
And what is your strategy towards resolving these errors?



1 answers

The problem with this error message is that you can not trace what is the root element that is triggering the exception. If you could see the full stack trace you would have a much better idea if the error is coming from a particular custom widget or if it is coming from a listview or dataview or a button.

In these cases I find it useful to activate the debug option for exceptions. This will then pause javascript execution whenever the program hits an exception and give you the full stack trace. Not only can you see what is the calling element but you can see the variables and their values at this invocation point. This then usually helps me solve the issue.