0

I have an error happening in code, and this is being triggered as part of a Scope.$eval. The stack trace doesn't give much clue from where it is happening.

How is it possible to debug / diagnose where is the actual code, or scope that the $eval is trying to execute?

The stack trace in Chrome DevTools would be as below.

SyntaxError: Unexpected token /
    at Object.parse (native)
    at fromJson (build/js/vendor.bundle.min.js:28655:14)
    at defaultHttpResponseTransform (build/js/vendor.bundle.min.js:36808:16)
    at build/js/vendor.bundle.min.js:36899:12
    at forEach (build/js/vendor.bundle.min.js:27739:20)
    at transformData (build/js/vendor.bundle.min.js:36898:3)
    at transformResponse (build/js/vendor.bundle.min.js:37678:23)
    at processQueue (build/js/vendor.bundle.min.js:42081:28)
    at build/js/vendor.bundle.min.js:42097:27
    at Scope.$eval (build/js/vendor.bundle.min.js:43325:28) undefined
Karl Cassar
  • 6,043
  • 10
  • 47
  • 84
  • In chrome when you click on `at fromJson (build/js/vendor.bundle.min.js:28655:14)` it should redirect you to relevant column. Also minifying changes variables but not function names so you can easily find appropriate function before grunt compress – Maxim Shoustin Nov 17 '15 at 10:55
  • 1
    No, the issue is it will show you the line of code with no idea of the context. My suggestion would be that the `Object.Parse()` would add also the string which cannot be parsed, not just what was unexpected. I discovered a nifty little feature in Chrome DevTools, that you can `Pause on exceptions` and `Pause On Caught Exceptions` (Ref: http://stackoverflow.com/questions/29263440/how-to-turn-on-pause-on-uncaught-exceptions-in-google-chrome-canary). This allowed me to find the context of the error being thrown, and discover the particular code which was throwing the error. – Karl Cassar Nov 17 '15 at 13:36

0 Answers0