Skip to content

Commit

Permalink
Merge pull request Ericsson#3516 from csordasmarton/print_broken_pipe…
Browse files Browse the repository at this point in the history
…_errors_properly

[server] Print broken pipe errors properly
  • Loading branch information
bruntib authored Nov 30, 2021
2 parents 6d35be2 + e8cd80b commit b559dd3
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions web/server/codechecker_server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,12 @@ def do_POST(self):
client_host, client_port, is_ipv6 = \
RequestHandler._get_client_host_port(self.client_address)
self.auth_session = self.__check_session_cookie()
LOG.info("%s:%s -- [%s] POST %s@%s",
client_host if not is_ipv6 else '[' + client_host + ']',
client_port,
self.auth_session.user if self.auth_session else "Anonymous",
self.path, fname)
auth_user = \
self.auth_session.user if self.auth_session else "Anonymous"
host_info = client_host if not is_ipv6 else '[' + client_host + ']'
api_info = f"{host_info}:{client_port} -- [{auth_user}] POST " \
f"{self.path}@{fname}"
LOG.info(api_info)

# Create new thrift handler.
version = self.server.version
Expand Down Expand Up @@ -455,9 +456,12 @@ def do_POST(self):
return

except BrokenPipeError as ex:
LOG.debug(ex)
except Exception as exn:
LOG.warning(str(exn))
LOG.warning("%s failed with BrokenPipeError: %s",
api_info, str(ex))
import traceback
traceback.print_exc()
except Exception as ex:
LOG.warning("%s failed with Exception: %s", api_info, str(ex))
import traceback
traceback.print_exc()

Expand All @@ -466,7 +470,7 @@ def do_POST(self):
itrans = TTransport.TMemoryBuffer(cstringio_buf)
iprot = input_protocol_factory.getProtocol(itrans)

self.send_thrift_exception(str(exn), iprot, oprot, otrans)
self.send_thrift_exception(str(ex), iprot, oprot, otrans)
return

def list_directory(self, path):
Expand Down

0 comments on commit b559dd3

Please sign in to comment.