Catch correct exception type in unit test

Refs #10057