Added more Moodle auth error handling and logging