Ensure and test that a proper exception is thrown (resulting in a
non-zero exit code)