Add more graceful error message.

@tymofij , @jmclaus please review.