Debugging errors in functions (stack traces?)

Suppose in one cell you define:

function call (f) {
  return f(10)

and in another you run:


(See notebook here.)

As the output to the second cell, Observable will report

TypeError: f is not a function

Which is true! But there’s no pointer to where f is defined, or where it’s incorrectly being used as a function.

This is a dumb toy example, but I’m running into situations in my notebooks where tracing down where an error is happening is legitimately difficult. Is there some way to get a stack trace? (Other than try { call(3) } catch (e) { console.log(e) }?)



Chrome’s dev tools allow you to halt on caught exceptions (via the pause button that looks like a stop sign). It’s not ideal though, because it will halt on any caught Promise exception (especially with lots of dependencies).

1 Like

Resurrecting this old thread to mention that Observable now supports tracing the entire call stack through which errors occur, and allows you to jump to the root cause of the error, if it happened in a different cell:


Whaaaaaaaaaaaat :astonished:

1 Like