Remove line 26
In this function, it will resolve to either the classList.add or the classList.remove code block due to the if-else statement.
But because you do not exit ('return;') the function when that is the case, it will always continue to the throw new Error line.
You should add a line with return; underneath both document.body.classList... lines so the function exits before it hits the throw new Error line