Skip to content

Commit

Permalink
Reraise exceptions in a Py2/Py3 compatible way
Browse files Browse the repository at this point in the history
Fixes #58
  • Loading branch information
miguelgrinberg committed Dec 9, 2017
1 parent a1eafcd commit 4a33200
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion engineio/asyncio_socket.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import asyncio
import six
import sys
import time

from . import exceptions
Expand Down Expand Up @@ -76,8 +77,9 @@ async def handle_get_request(self, environ):
try:
packets = await self.poll()
except exceptions.QueueEmpty:
exc = sys.exc_info()
await self.close(wait=False)
raise
six.reraise(*exc)
return packets

async def handle_post_request(self, environ):
Expand Down
4 changes: 3 additions & 1 deletion engineio/socket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import six
import sys
import time

from . import exceptions
Expand Down Expand Up @@ -91,8 +92,9 @@ def handle_get_request(self, environ, start_response):
try:
packets = self.poll()
except exceptions.QueueEmpty:
exc = sys.exc_info()
self.close(wait=False)
raise
six.reraise(*exc)
return packets

def handle_post_request(self, environ):
Expand Down

0 comments on commit 4a33200

Please sign in to comment.