Added test for cause of error and more helpful error message

Refs #9831