Skip to content

Commit

Permalink
Don't use 'raise exc from None' because it suppresses exception causes (
Browse files Browse the repository at this point in the history
#1158)

Co-authored-by: oTree-org <chris@otree.org>
  • Loading branch information
oTree-org and oTree-org committed Mar 29, 2021
1 parent 5ee04ef commit 1222e78
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion starlette/endpoints.py
Expand Up @@ -71,7 +71,7 @@ async def dispatch(self) -> None:
break
except Exception as exc:
close_code = status.WS_1011_INTERNAL_ERROR
raise exc from None
raise exc
finally:
await self.on_disconnect(websocket, close_code)

Expand Down
2 changes: 1 addition & 1 deletion starlette/exceptions.py
Expand Up @@ -79,7 +79,7 @@ async def sender(message: Message) -> None:
handler = self._lookup_exception_handler(exc)

if handler is None:
raise exc from None
raise exc

if response_started:
msg = "Caught handled exception, but response already started."
Expand Down
2 changes: 1 addition & 1 deletion starlette/middleware/errors.py
Expand Up @@ -178,7 +178,7 @@ async def _send(message: Message) -> None:
# We always continue to raise the exception.
# This allows servers to log the error, or allows test clients
# to optionally raise the error within the test case.
raise exc from None
raise exc

def format_line(
self, index: int, line: str, frame_lineno: int, frame_index: int
Expand Down
2 changes: 1 addition & 1 deletion starlette/testclient.py
Expand Up @@ -240,7 +240,7 @@ async def send(message: Message) -> None:
loop.run_until_complete(self.app(scope, receive, send))
except BaseException as exc:
if self.raise_server_exceptions:
raise exc from None
raise exc

if self.raise_server_exceptions:
assert response_started, "TestClient did not receive any response."
Expand Down

0 comments on commit 1222e78

Please sign in to comment.