Added more helpful JS error messages.