Tests that expect errors check error codes. Fixes issue78