Fixing exception checking.

Refs #5591