Catch exceptions and display proper error, closes #1875.
Merge pull request #1914 from cmfcmf/fix-1875

Catch exceptions and display proper error, closes #1875.