Handle API errors a little more gracefully.