Browse Source

No need to catch exceptions here; they shouldn't occur

tags/nilmdb-2.0.0
Jim Paris 2 years ago
parent
commit
640c1bc95e
1 changed files with 4 additions and 7 deletions
  1. +4
    -7
      nilmdb/server/serverutil.py

+ 4
- 7
nilmdb/server/serverutil.py View File

@@ -126,13 +126,10 @@ def json_error_page(status, message, traceback, version,
"message" : message,
"traceback" : traceback }
# Don't send a traceback if the error was 400-499 (client's fault)
try:
code = int(status.split()[0])
if not force_traceback:
if code >= 400 and code <= 499:
errordata["traceback"] = ""
except Exception: # pragma: no cover
pass
code = int(status.split()[0])
if not force_traceback:
if code >= 400 and code <= 499:
errordata["traceback"] = ""
# Override the response type, which was previously set to text/html
cherrypy.serving.response.headers['Content-Type'] = (
"application/json;charset=utf-8" )


Loading…
Cancel
Save