openfun / joanie

👛 A headless ERP for education to manage course enrollment/subscription, payment and certificates delivery.
MIT License
20 stars 2 forks source link

🐛(backend) moodle user creation must raise EnrollmentError exception #833

Closed jbpenrath closed 3 weeks ago

jbpenrath commented 3 weeks ago

Purpose

Currently, in MoodleBackend, if during a set_enrollment, a user must be created and this task failed, a MoodleUserCreateException is raised. This exception is not caught by the method set of the Enrollment model and it should not be manage as this is too specific exception. But currently, if this error is raised when we try to auto enroll a user during an order validation, the order validation can be rollback. That's why we have to improve this error management and raise an EnrollmentError instead.

https://gip-fun-mooc.sentry.io/issues/5141416829/?environment=preproduction&project=6599941&query=is:unresolved+issue.priority:%5Bhigh,+medium%5D&statsPeriod=90d&stream_index=7&utc=true