mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
make sure we return the correct error with the last traceback.
fix #630
This commit is contained in:
parent
41e7aba3a9
commit
0e4d9f0378
@ -7,6 +7,7 @@ from datetime import datetime
|
|||||||
import errno
|
import errno
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import sys
|
||||||
|
|
||||||
import gunicorn.http as http
|
import gunicorn.http as http
|
||||||
import gunicorn.http.wsgi as wsgi
|
import gunicorn.http.wsgi as wsgi
|
||||||
@ -48,9 +49,13 @@ class AsyncWorker(base.Worker):
|
|||||||
except StopIteration as e:
|
except StopIteration as e:
|
||||||
self.log.debug("Closing connection. %s", e)
|
self.log.debug("Closing connection. %s", e)
|
||||||
except ssl.SSLError:
|
except ssl.SSLError:
|
||||||
raise # pass to next try-except level
|
exc_info = sys.exc_info()
|
||||||
|
# pass to next try-except level
|
||||||
|
six.reraise(exc_info[0], exc_info[1], exc_info[2])
|
||||||
except socket.error:
|
except socket.error:
|
||||||
raise # pass to next try-except level
|
exc_info = sys.exc_info()
|
||||||
|
# pass to next try-except level
|
||||||
|
six.reraise(exc_info[0], exc_info[1], exc_info[2])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.handle_error(req, client, addr, e)
|
self.handle_error(req, client, addr, e)
|
||||||
except ssl.SSLError as e:
|
except ssl.SSLError as e:
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import os
|
|||||||
import select
|
import select
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import sys
|
||||||
|
|
||||||
import gunicorn.http as http
|
import gunicorn.http as http
|
||||||
import gunicorn.http.wsgi as wsgi
|
import gunicorn.http.wsgi as wsgi
|
||||||
@ -144,7 +145,9 @@ class SyncWorker(base.Worker):
|
|||||||
if hasattr(respiter, "close"):
|
if hasattr(respiter, "close"):
|
||||||
respiter.close()
|
respiter.close()
|
||||||
except socket.error:
|
except socket.error:
|
||||||
raise
|
exc_info = sys.exc_info()
|
||||||
|
# pass to next try-except level
|
||||||
|
six.reraise(exc_info[0], exc_info[1], exc_info[2])
|
||||||
except Exception:
|
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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user