observablehq / stdlib

The Observable standard library.
https://observablehq.com/@observablehq/standard-library
ISC License
957 stars 83 forks source link

Catch more invalid data sources #373

Closed annie closed 1 year ago

annie commented 1 year ago

Companion PR to https://github.com/observablehq/observablehq/pull/12427

If a user selects a cell with a primitive value, the call to cache.get throws an "invalid value used as WeakMap key" error. I think it's more informative to show "invalid data source" in that case, and in general I'd like to standardize the error message across all cases where the data source isn't valid.