If this is in a try/catch we can throw a useful error if the user writes some messed up Javascript.