diff --git a/lms/djangoapps/certificates/models.py b/lms/djangoapps/certificates/models.py index a1fd62041c..d7e189ccb9 100644 --- a/lms/djangoapps/certificates/models.py +++ b/lms/djangoapps/certificates/models.py @@ -63,6 +63,7 @@ class GeneratedCertificate(models.Model): auto_now_add=True, default=datetime.now) modified_date = models.DateTimeField( auto_now=True, default=datetime.now) + error_reason = models.CharField(max_length=512, blank=True, default='') class Meta: unique_together = (('user', 'course_id'),) diff --git a/lms/djangoapps/certificates/views.py b/lms/djangoapps/certificates/views.py index 390dca1ef7..ae15245588 100644 --- a/lms/djangoapps/certificates/views.py +++ b/lms/djangoapps/certificates/views.py @@ -43,6 +43,20 @@ def update_certificate(request): if 'error' in xqueue_body: cert.status = status.error + if 'error_reason' in xqueue_body: + + # Hopefully we will record a meaningful error + # here if something bad happened during the + # certificate generation process + # + # example: + # (aamorm BerkeleyX/CS169.1x/2012_Fall) + # : + # HTTP error (reason=error(32, 'Broken pipe'), filename=None) : + # certificate_agent.py:175 + + + cert.error_reason = xqueue_body['error_reason'] else: if cert.status in [status.generating, status.regenerating]: cert.download_uuid = xqueue_body['download_uuid']