Updated Moodle error handling