Better error handling. Refs #7636.