Make error expectation generic.