add javascript error handler to help with debugging