This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 9b76162 more comments, add newline to traceback msg
9b76162 is described below
commit 9b76162eedd8071413a3da7e7e5b560b0b7d411e
Author: Daniel Gruno <[email protected]>
AuthorDate: Thu Sep 10 12:10:05 2020 +0200
more comments, add newline to traceback msg
---
server/main.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/server/main.py b/server/main.py
index 22161ed..5798dfa 100644
--- a/server/main.py
+++ b/server/main.py
@@ -133,11 +133,16 @@ class Server(plugins.server.BaseServer):
err = "\n".join(
traceback.format_exception(exc_type, exc_value,
exc_traceback)
)
+ # By default, we print the traceback to the user, for easy
debugging.
if self.config.ui.traceback:
return aiohttp.web.Response(
- headers=headers, status=500, text="API error occurred:
" + err
+ headers=headers, status=500, text="API error occurred:
\n" + err
)
+ # If client traceback is disabled, we print it to stderr
instead, but leave an
+ # error ID for the client to report back to the admin. Every
line of the traceback
+ # will have this error ID at the beginning of the line, for
easy grepping.
else:
+ # We only need a short ID here, let's pick 18 chars.
eid = str(uuid.uuid4())[:18]
sys.stderr.write("API Endpoint %s got into trouble (%s):
\n" % (request.path, eid))
for line in err.split("\n"):