Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
trs
Commits
6bc1ba68
Commit
6bc1ba68
authored
Jun 13, 2012
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
On error, add a traceback to the JSON object.
parent
b74f5aed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
src/backend/backend.py
src/backend/backend.py
+12
-4
No files found.
src/backend/backend.py
View file @
6bc1ba68
...
...
@@ -17,6 +17,9 @@ from tornado.web import RequestHandler, Application
from
src.parser
import
Parser
from
tests.parser
import
ParserWrapper
from
src.validation
import
validate
as
validate_expression
import
sys
import
traceback
# Log debug information
from
logging
import
getLogger
,
DEBUG
...
...
@@ -39,6 +42,11 @@ def get_last_line(handler):
return
last_line
def
format_exception
(
e
):
tb
=
sys
.
exc_info
()[
2
]
return
{
'error'
:
str
(
e
),
'traceback'
:
traceback
.
format_tb
(
tb
)}
class
Step
(
RequestHandler
):
def
post
(
self
):
try
:
...
...
@@ -59,7 +67,7 @@ class Step(RequestHandler):
self
.
write
({
'hint'
:
'No further reduction is possible.'
})
except
Exception
as
e
:
self
.
write
(
{
'error'
:
str
(
e
)}
)
self
.
write
(
format_exception
(
e
)
)
class
Answer
(
RequestHandler
):
...
...
@@ -85,7 +93,7 @@ class Answer(RequestHandler):
self
.
write
({
'hint'
:
'No further reduction is possible.'
})
except
Exception
as
e
:
self
.
write
(
{
'error'
:
str
(
e
)}
)
self
.
write
(
format_exception
(
e
)
)
class
Hint
(
RequestHandler
):
...
...
@@ -104,7 +112,7 @@ class Hint(RequestHandler):
self
.
write
({
'hint'
:
'No further reduction is possible.'
})
except
Exception
as
e
:
self
.
write
(
{
'error'
:
str
(
e
)}
)
self
.
write
(
format_exception
(
e
)
)
class
Validate
(
RequestHandler
):
...
...
@@ -143,7 +151,7 @@ class Validate(RequestHandler):
self
.
write
({
'validated'
:
i
-
skipped
})
except
Exception
as
e
:
i
-=
1
self
.
write
(
{
'error'
:
str
(
e
),
'validated'
:
i
-
skipped
})
self
.
write
(
format_exception
(
e
)
+
{
'validated'
:
i
-
skipped
})
urls
=
[
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment