Skip to content

Commit

Permalink
Add debug option
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Dec 21, 2012
1 parent 302b600 commit 33c6180
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions settings.py
@@ -0,0 +1 @@
DEBUG = False
22 changes: 15 additions & 7 deletions shell.py
Expand Up @@ -65,6 +65,7 @@
from sympy import srepr, sstr, pretty, latex

import detectmobile
import settings

PRINTERS = {
'repr': srepr,
Expand Down Expand Up @@ -766,14 +767,21 @@ def post(self):
'session': str(session_key),
'output': 'Error: Operation timed out.'
}

except Exception, e:
errmsg = '\n'.join([
'Exception in SymPy Live of type ',
str(type(e)),
'for reference the last 5 stack trace entries are',
traceback.format_exc(5)
])
if settings.DEBUG:
errmsg = '\n'.join([
'Exception in SymPy Live of type ',
str(type(e)),
'for reference the stack trace is',
traceback.format_exc()
])
else:
errmsg = '\n'.join([
'Exception in SymPy Live of type ',
str(type(e)),
'for reference the last 5 stack trace entries are',
traceback.format_exc(5)
])
result = {
'session': str(session_key),
'output': errmsg
Expand Down

0 comments on commit 33c6180

Please sign in to comment.