clearer error

This commit is contained in:
Felix Roos 2022-10-27 21:20:01 +02:00
parent db1fc399a1
commit ecfeac4d63

View File

@ -115,7 +115,11 @@ const getSampleBufferSource = async (s, n, note, speed) => {
}
const bank = samples?.[s];
if (!bank) {
throw new Error(`sample not found: "${s}", try one of ${Object.keys(samples).join(', ')}`);
throw new Error(
`sample not found: "${s}", try one of ${Object.keys(samples)
.map((s) => `"${s}"`)
.join(', ')}.`,
);
}
if (typeof bank !== 'object') {
throw new Error('wrong format for sample bank:', s);