The user can enter in their moodlenet profile information from the user edit page which doesn't run through the same validation as the moodlenet redirect page.
In situations where the profile information is wrong when this method is called it will throw an exception. We should catch that exception and return null. That would ask the user to enter in a moodlenet profile and the proper validation can happen here.
Things to do:
- In get_moodlenet_user_profile method catch the exception and return null.
- Change the current exception thrown to a moodle_exception.
- Update the unit tests to test for an invalid username already stored.
- Both Master and stable plugin to be updated.