mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-12 16:10:57 +00:00
Use raise from to reserve stacktrace
This commit is contained in:
@ -18,7 +18,7 @@ class RawConnection(IRawConnection):
|
|||||||
try:
|
try:
|
||||||
await self.stream.write(data)
|
await self.stream.write(data)
|
||||||
except IOException as error:
|
except IOException as error:
|
||||||
raise RawConnError(error)
|
raise RawConnError from error
|
||||||
|
|
||||||
async def read(self, n: int = None) -> bytes:
|
async def read(self, n: int = None) -> bytes:
|
||||||
"""
|
"""
|
||||||
@ -30,7 +30,7 @@ class RawConnection(IRawConnection):
|
|||||||
try:
|
try:
|
||||||
return await self.stream.read(n)
|
return await self.stream.read(n)
|
||||||
except IOException as error:
|
except IOException as error:
|
||||||
raise RawConnError(error)
|
raise RawConnError from error
|
||||||
|
|
||||||
async def close(self) -> None:
|
async def close(self) -> None:
|
||||||
await self.stream.close()
|
await self.stream.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user