Fix up my refactoring mistake in toThrowError

strengthen the associated tests to protect against it in the future