Commit c0a4ff37 by ichuang

more useful debugging message for capa problem script errors

parent 411e77e1
...@@ -393,9 +393,10 @@ class LoncapaProblem(object): ...@@ -393,9 +393,10 @@ class LoncapaProblem(object):
context['script_code'] += code # store code source in context context['script_code'] += code # store code source in context
try: try:
exec code in context, context # use "context" for global context; thus defs in code are global within code exec code in context, context # use "context" for global context; thus defs in code are global within code
except Exception: except Exception as err:
log.exception("Error while execing script code: " + code) log.exception("Error while execing script code: " + code)
raise responsetypes.LoncapaProblemError("Error while executing script code") msg = "Error while executing script code: %s" % str(err).replace('<','&lt;')
raise responsetypes.LoncapaProblemError(msg)
finally: finally:
sys.path = original_path sys.path = original_path
......
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