Danny
Danny

Reputation: 3690

How do I debug this reported error in Chrome's console?

Chrome's console reports an error.

It lists the name of a function -- presumably, the one where an error is happening.

It doesn't break. It doesn't tell me any further details. I can't make it break with the "Pause on Exceptions" button.

Is there some step that I'm missing for what to do with this error? What does Chrome intend for me to do? This is a frequently-called function, so narrowing it down on the particular use case is a fickle problem.

"It doesn't actually help any more than that" is a perfectly acceptable answer. I just wanted that confirmed or refuted as I continue to battle with this cryptic console output.

This is the expanded "<error>" message. ResolveRests is my function.

Upvotes: 0

Views: 146

Answers (2)

icktoofay
icktoofay

Reputation: 128991

While in most cases the answer would be to break on exceptions, as I showed in my previous answer, that appears to not be the case here.

The problem is likely caused by some code which causes generating a stack trace to fail. Here's a portion of the relevant code in V8:

function FormatStackTrace(error, frames) {
  var lines = [];
  try {
    lines.push(error.toString());
  } catch (e) {
    try {
      lines.push("<error: " + e + ">");
    } catch (ee) {
      lines.push("<error>");
    }
  }
  for (var i = 0; i < frames.length; i++) {
    var frame = frames[i];
    var line;
    try {
      line = frame.toString();
    } catch (e) {
      try {
        line = "<error: " + e + ">";
      } catch (ee) {
        // Any code that reaches this point is seriously nasty!
        line = "<error>";
      }
    }
    lines.push("    at " + line);
  }
  return lines.join("\n");
}

As you can see, you will get <error> if it fails to get a string representation of an uncaught exception or a stack frame, and then when it tries to get the string representation of that, it fails. For example, if you run this code:

function NastyException() {}
NastyException.prototype.toString = function() { throw this; };
throw new NastyException();

Then you'll get this unhelpful error:

Uncaught #<error>

Admittedly that's not quite the error that you were receiving, but it's not that far off.

Upvotes: 1

icktoofay
icktoofay

Reputation: 128991

Try breaking on exceptions. You can do this by clicking on the stop sign with pause icon button.

It toggles between three colors: black, blue, and purple.

When it is black, it is not breaking on exceptions.
When it is blue, it is breaking on all exceptions.
When it is purple, it is breaking on uncaught exceptions.

Upvotes: 1

Related Questions