Fix deprecated use of raise_error with to_not.