pull/8411/head
Simon H 3 years ago committed by GitHub
parent a49a59f43d
commit ca6d2cacb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -112,7 +112,13 @@ export function validate_each_keys(ctx, list, get_context, get_key) {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const key = get_key(get_context(ctx, list, i)); const key = get_key(get_context(ctx, list, i));
if (keys.has(key)) { if (keys.has(key)) {
throw new Error(`Cannot have duplicate keys in a keyed each: Keys at index ${keys.get(key)} and ${i} are duplicates`); let value = '';
try {
value = `with value '${String(key)}' `;
} catch (e) {
// can't stringify
}
throw new Error(`Cannot have duplicate keys in a keyed each: Keys at index ${keys.get(key)} and ${i} ${value}are duplicates`);
} }
keys.set(key, i); keys.set(key, i);
} }

@ -3,5 +3,5 @@ export default {
dev: true dev: true
}, },
error: 'Cannot have duplicate keys in a keyed each: Keys at index 0 and 3 are duplicates' error: 'Cannot have duplicate keys in a keyed each: Keys at index 0 and 3 with value \'1\' are duplicates'
}; };

Loading…
Cancel
Save