Improve debug output
This commit is contained in:
parent
e286c0e023
commit
3593e5d95d
1 changed files with 6 additions and 5 deletions
11
main.py
11
main.py
|
@ -2,6 +2,7 @@ import cgi
|
|||
import datetime
|
||||
import pytz
|
||||
import html
|
||||
import traceback
|
||||
|
||||
import workers.conn
|
||||
import workers.val
|
||||
|
@ -78,7 +79,7 @@ def doConn(req):
|
|||
except Exception as e:
|
||||
content = "<h1>500 Internal Server Error</h1>\n"
|
||||
if "debug" in req.args:
|
||||
content += str(e)
|
||||
content += traceback.format_exc().replace("\n", "<br />")
|
||||
return Response(HTTP500, HTML, content)
|
||||
|
||||
return Response(HTTP200, JSON if req.json else XML, content)
|
||||
|
@ -104,7 +105,7 @@ def doVal(req):
|
|||
except Exception as e:
|
||||
content = "<h1>500 Internal Server Error</h1>\n"
|
||||
if "debug" in req.args:
|
||||
content += str(e).encode()
|
||||
content += traceback.format_exc().replace("\n", "<br />")
|
||||
return Response(HTTP500, HTML, content)
|
||||
|
||||
return Response(HTTP200, JSON if req.json else XML, content)
|
||||
|
@ -139,7 +140,7 @@ def doNearby(req):
|
|||
except Exception as e:
|
||||
content = "<h1>500 Internal Server Error</h1>"
|
||||
if "debug" in req.args:
|
||||
content += repr(e)
|
||||
content += traceback.format_exc().replace("\n", "<br />")
|
||||
return Response(HTTP500, HTML, content)
|
||||
|
||||
return Response(HTTP200, JSON if req.json else XML, content)
|
||||
|
@ -152,7 +153,7 @@ def doRadar(req):
|
|||
except Exception as e:
|
||||
content = "<h1>500 Internal Server Error</h1>\n"
|
||||
if "debug" in req.args:
|
||||
content += repr(e)
|
||||
content += traceback.format_exc().replace("\n", "<br />")
|
||||
return Response(HTTP500, HTML, content)
|
||||
|
||||
return Response(HTTP200, JSON if req.json else XML, content)
|
||||
|
@ -195,7 +196,7 @@ def doDepArr(req):
|
|||
except Exception as e:
|
||||
content = "<h1>500 Internal Server Error</h1>\n"
|
||||
if "debug" in req.args:
|
||||
content += str(e)
|
||||
content += traceback.format_exc().replace("\n", "<br />")
|
||||
return Response(HTTP500, HTML, content)
|
||||
|
||||
return Response(HTTP200, JSON if req.json else XML, content)
|
||||
|
|
Loading…
Reference in a new issue