observablehq / inspector

The Observable standard inspector.
ISC License
143 stars 20 forks source link

Uncaught error when reading a Proxy object #186

Open Fil opened 1 year ago

Fil commented 1 year ago

The following code will log an error in the console, and the inspector will not return.

new Proxy({}, {ownKeys: function () { throw new Error("gotcha"); }})

I'd expect the inspector to catch the error and surface it (in red).

This error happens for real when using the HISTOGRAM() function in DuckDB, which returns a Proxy that doesn’t let us enumerate its keys via for…in at https://github.com/observablehq/inspector/blob/63535de10ffb802959324e73553b9825311bfe48/src/expanded.js#L119 (The Proxy object from Apache Arrow throws “TypeError: 0 is not a valid property name”.)

(with thanks to @mootari)