Catch the error thrown by failed regression

This is a patch for issue #592.