Better error message.

fix gh-2224