Just return a null progress if something goes wrong when retrieving capa_module progress (and log the error)

This commit is contained in:
Calen Pennington
2012-09-06 15:18:59 -04:00
parent 897a87646c
commit 14eb160eea

View File

@@ -202,10 +202,8 @@ class CapaModule(XModule):
try:
return Progress(score, total)
except Exception as err:
# TODO (vshnayder): why is this still here? still needed?
if self.system.DEBUG:
return None
raise
log.exception("Got bad progress")
return None
return None
def get_html(self):
@@ -322,16 +320,10 @@ class CapaModule(XModule):
before = self.get_progress()
d = handlers[dispatch](get)
try:
after = self.get_progress()
d.update({
'progress_changed': after != before,
'progress_status': Progress.to_js_status_str(after),
})
except ValueError:
d.update({
'progress_changed': False,
'progress_status': Progress.to_js_status(before),
after = self.get_progress()
d.update({
'progress_changed': after != before,
'progress_status': Progress.to_js_status_str(after),
})
return json.dumps(d, cls=ComplexEncoder)