Include stack trace in Course Rerun errors; Log errors.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Model Managers for Course Actions
|
||||
"""
|
||||
import traceback
|
||||
from django.db import models, transaction
|
||||
|
||||
|
||||
@@ -135,14 +136,14 @@ class CourseRerunUIStateManager(CourseActionUIStateManager):
|
||||
new_state=self.State.SUCCEEDED,
|
||||
)
|
||||
|
||||
def failed(self, course_key, exception):
|
||||
def failed(self, course_key):
|
||||
"""
|
||||
To be called when an existing rerun for the given course has failed with the given exception.
|
||||
To be called within an exception handler when an existing rerun for the given course has failed.
|
||||
"""
|
||||
self.update_state(
|
||||
course_key=course_key,
|
||||
new_state=self.State.FAILED,
|
||||
message=exception.message,
|
||||
message=traceback.format_exc(),
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -91,12 +91,17 @@ class TestCourseRerunStateManager(TestCase):
|
||||
|
||||
# set state to fail
|
||||
exception = Exception("failure in rerunning")
|
||||
CourseRerunState.objects.failed(course_key=self.course_key, exception=exception)
|
||||
self.expected_rerun_state.update({
|
||||
'state': CourseRerunUIStateManager.State.FAILED,
|
||||
'message': exception.message,
|
||||
})
|
||||
try:
|
||||
raise exception
|
||||
except:
|
||||
CourseRerunState.objects.failed(course_key=self.course_key)
|
||||
|
||||
self.expected_rerun_state.update(
|
||||
{'state': CourseRerunUIStateManager.State.FAILED}
|
||||
)
|
||||
self.expected_rerun_state.pop('message')
|
||||
rerun = self.verify_rerun_state()
|
||||
self.assertIn(exception.message, rerun.message)
|
||||
|
||||
# dismiss ui and verify
|
||||
self.dismiss_ui_and_verify(rerun)
|
||||
|
||||
Reference in New Issue
Block a user