Gracefully handle bad JS code