explicit raise from

This commit is contained in:
AF 2022-12-30 09:49:56 +00:00
parent c718d4d142
commit 63bfee71bf
2 changed files with 7 additions and 7 deletions

View File

@ -81,8 +81,8 @@ class V6D0AuthAppFactory(AppFactory):
async def pull(request: web.Request):
try:
pulled = await pulled_for_request(request)
except KeyError:
raise web.HTTPNotFound
except KeyError as e:
raise web.HTTPNotFound from e
else:
return web.Response(body=pulled)

View File

@ -3,7 +3,7 @@ from nacl.exceptions import BadSignatureError
from nacl.signing import VerifyKey
from v6d0auth import certs
from v6d0auth.config import myroot, caurl
from v6d0auth.config import caurl, myroot
__all__ = ('request_signature', 'mycert', 'has_role', 'request_role', 'with_role',)
@ -17,8 +17,8 @@ async def request_signature() -> bytes:
await ws.send_bytes(certs.vkey.encode())
try:
return await ws.receive_bytes()
except TypeError:
raise RuntimeError("signature request failed")
except TypeError as e:
raise RuntimeError("signature request failed") from e
_certfile = myroot / 'cert'
@ -49,8 +49,8 @@ async def request_role(role: str) -> bytes:
await ws.send_bytes(certs.vkey.encode())
try:
return await ws.receive_bytes()
except TypeError:
raise RuntimeError("role request failed")
except TypeError as e:
raise RuntimeError("role request failed") from e
async def with_role(role: str):