letting JavaScript handle errors for JavaScript functions