Commit 25ec2179 by Calen Pennington

Merge pull request #1561 from cpennington/hotfix-assertion-error

Fix AssertionErrors that were raised when creation of an XModule failed
parents 7013c997 d7766a7b
......@@ -739,11 +739,16 @@ class XModuleDescriptor(XModuleMixin, HTMLSnippet, ResourceTemplates, XBlock):
)
self.xmodule_runtime.xmodule_instance.save()
except Exception: # pylint: disable=broad-except
if isinstance(self, self.xmodule_runtime.error_descriptor_class):
log.exception('Error creating an ErrorModule from an ErrorDescriptor')
raise
log.exception('Error creating xmodule')
descriptor = self.xmodule_runtime.error_descriptor_class.from_descriptor(
self,
error_msg=exc_info_to_str(sys.exc_info())
)
descriptor.xmodule_runtime = self.xmodule_runtime
self.xmodule_runtime.xmodule_instance = descriptor._xmodule # pylint: disable=protected-access
return self.xmodule_runtime.xmodule_instance
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment