balteo
balteo

Reputation: 24679

Understanding a chrome javascript stacktrace

I have a few questions regarding the following javascript stacktrace.

  1. Why are there two parts to the stacktrace: a first one in red at the top and a second one in black below?
  2. What does the first line beginning with at mean? i.e. at angular.js:63: why is it not referring to a function/method call like the other lines?
  3. How is it ordered? Do the lines at the bottom occur before the lines at the top?

javascript stacktrace

Upvotes: 8

Views: 2473

Answers (2)

Siva Senthil
Siva Senthil

Reputation: 610

Chrome uses v8 engine to work on JavaScript. So, I am quoting the v8.dev docs for the answer:

  1. I am not sure about answer to this question.

  2. The first line tells us the location where the error occurred. With framework like angular, it could be deep inside the framework it need not be user code.

  3. Yes it is bottom up, i.e. from the point where the error occurred to upwards towards the caller, in this case to a jQuery event dispatch.

Upvotes: 1

phuzi
phuzi

Reputation: 13059

  1. The bits in red are the exception/error message - in this case it looks like Angular has thrown an exception and as part of that exception it has added the contents of the stacktrace to the message, whilst the black bits are the stack trace that you'd get whenever the browser experiences an unhandled exception.
    1. The first line at states where the error occured - script name and line number - if you take a look at the source of angular.js at line 63 you will see the statement that threw the exception.
    2. It it's not referring to a function call as it is the statement that threw the exception. The only way to get to that statement is through a series of function calls, these are then shown in reverse order.
  2. Correct. For example the Scope.$apply function makes a call to Scope.$eval and Scope.$eval calls a function called callback, etc.

Upvotes: 3

Related Questions