inspector icon indicating copy to clipboard operation
inspector copied to clipboard

Uncaught error when reading a Proxy object

Open Fil opened this issue 2 years ago • 0 comments

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)

Fil avatar Aug 08 '23 05:08 Fil