mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Clean up some inconsistent in error handling
It is more DRY to let the exception here bubble.
This commit is contained in:
parent
b981014acc
commit
88ccfdb981
@ -102,10 +102,13 @@ class SyncWorker(base.Worker):
|
|||||||
self.log.debug("Error processing SSL request.")
|
self.log.debug("Error processing SSL request.")
|
||||||
self.handle_error(req, client, addr, e)
|
self.handle_error(req, client, addr, e)
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
if e.args[0] != errno.EPIPE:
|
if e.args[0] not in (errno.EPIPE, errno.ECONNRESET):
|
||||||
self.log.exception("Error processing request.")
|
self.log.exception("Socket error processing request.")
|
||||||
else:
|
else:
|
||||||
self.log.debug("Ignoring EPIPE")
|
if e.args[0] == errno.ECONNRESET:
|
||||||
|
self.log.debug("Ignoring connection reset")
|
||||||
|
else:
|
||||||
|
self.log.debug("Ignoring EPIPE")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.handle_error(req, client, addr, e)
|
self.handle_error(req, client, addr, e)
|
||||||
finally:
|
finally:
|
||||||
@ -142,7 +145,7 @@ class SyncWorker(base.Worker):
|
|||||||
respiter.close()
|
respiter.close()
|
||||||
except socket.error:
|
except socket.error:
|
||||||
raise
|
raise
|
||||||
except Exception as e:
|
except Exception:
|
||||||
if resp and resp.headers_sent:
|
if resp and resp.headers_sent:
|
||||||
# If the requests have already been sent, we should close the
|
# If the requests have already been sent, we should close the
|
||||||
# connection to indicate the error.
|
# connection to indicate the error.
|
||||||
@ -153,9 +156,7 @@ class SyncWorker(base.Worker):
|
|||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
raise StopIteration()
|
raise StopIteration()
|
||||||
# Only send back traceback in HTTP in debug mode.
|
raise
|
||||||
self.handle_error(req, client, addr, e)
|
|
||||||
return
|
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
self.cfg.post_request(self, req, environ, resp)
|
self.cfg.post_request(self, req, environ, resp)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user