Skip to content

Commit

Permalink
Update slice and error
Browse files Browse the repository at this point in the history
  • Loading branch information
reimu committed Oct 4, 2023
1 parent a1f96dc commit 6d453f4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function t(notes: string, steps: number): string {
if (newPos < 0 || newPos >= keys.length) {
throw new Error(
`detected key outside of range: ${key}` +
`, at position: ${i};${notes.slice(i - 3, i + 3)}`
`, at position: ${i};${notes.slice(i - 5, i + 5)}`
);
}
return keys[pos + steps];
Expand All @@ -120,7 +120,7 @@ transposeEle.addEventListener("click", () => {
const notes = inputEle.value;
const steps = parseInt(stepsEle.value, 10);
if (isNaN(steps)) {
throw new Error(`Invalid steps: ${stepsEle.value} - ${steps}`);
throw new Error(`Invalid steps: ${stepsEle.value}`);
}
const result = t(notes, steps);
outputEle.value = result;
Expand Down

0 comments on commit 6d453f4

Please sign in to comment.