Skip to content

Commit 6016457

Browse files
committed
Convert Error to TypeError for some usage issues
1 parent cf8fc50 commit 6016457

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ function dispatchQueueBatch<K, V>(
262262

263263
// Assert the expected resolution from batchLoadFn.
264264
if (!Array.isArray(values)) {
265-
throw new Error(
265+
throw new TypeError(
266266
'DataLoader must be constructed with a function which accepts ' +
267267
'Array<key> and returns Promise<Array<value>>, but the function did ' +
268268
`not return a Promise of an Array: ${String(values)}.`
269269
);
270270
}
271271
if (values.length !== keys.length) {
272-
throw new Error(
272+
throw new TypeError(
273273
'DataLoader must be constructed with a function which accepts ' +
274274
'Array<key> and returns Promise<Array<value>>, but the function did ' +
275275
'not return a Promise of an Array of the same length as the Array ' +

0 commit comments

Comments
 (0)