improved error handling - catch errors around lcp.get_html()
This commit is contained in:
@@ -117,7 +117,18 @@ class Module(XModule):
|
||||
'''Return html for the problem. Adds check, reset, save buttons
|
||||
as necessary based on the problem config and state.'''
|
||||
|
||||
html = self.lcp.get_html()
|
||||
try:
|
||||
html = self.lcp.get_html()
|
||||
except Exception, err:
|
||||
if self.DEBUG:
|
||||
log.exception(err)
|
||||
msg = '[courseware.capa.capa_module] <font size="+1" color="red">Failed to generate HTML for problem %s</font>' % (self.filename)
|
||||
msg += '<p>Error:</p><p><pre>%s</pre></p>' % str(err).replace('<','<')
|
||||
msg += '<p><pre>%s</pre></p>' % traceback.format_exc().replace('<','<')
|
||||
html = msg
|
||||
else:
|
||||
raise
|
||||
|
||||
content = {'name': self.name,
|
||||
'html': html,
|
||||
'weight': self.weight,
|
||||
|
||||
Reference in New Issue
Block a user