Debugging a function in observable

For general notebook debugging, are you making use of your browser’s dev tools? I often use console.log to print out intermediate values in the dev console and debugger to set a breakpoint in the JavaScript debugger (which you can then use to step through execution). There’s some basic advice here.

In Firefox, there’s a strange error:

[Exception... "Failure"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: https://static.observableusercontent.com/worker/worker.54d38e47fc95010b5bef5208d55ffd52ae344c93b2e4f1ffdee38a96e153a0c4.js line 2 > eval :: rotate :: line 4"  data: no]

which is triggered by this line:

    const bbox = this.getBBox();

I guess because getBBox is failing. Maybe related to this post?

In Chrome bbox becomes an SVGRect {x: 0, y: 0, width: 0, height: 0}, which causes all rx and ry to be zero, and seems like it may not be what you want.

1 Like