added util method to detect javascript errors