Skip to content

Commit 1c27e0f

Browse files
Annie Zhangmbostock
andauthored
Catch more invalid data sources (#373)
* Catch more invalid data sources * Update src/table.js Co-authored-by: Mike Bostock <[email protected]> --------- Co-authored-by: Mike Bostock <[email protected]>
1 parent 0d02402 commit 1c27e0f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/table.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export async function loadDataSource(source, mode, name) {
184184
function sourceCache(loadSource) {
185185
const cache = new WeakMap();
186186
return (source, name) => {
187-
if (!source) throw new Error("data source not found");
187+
if (!source || typeof source !== "object") throw new Error("invalid data source");
188188
let promise = cache.get(source);
189189
if (!promise || (isDataArray(source) && source.length !== promise._numRows)) {
190190
// Warning: do not await here! We need to populate the cache synchronously.

0 commit comments

Comments
 (0)