From 63bfee71bf69a4e04907f83a4e92e9c2211a0e4e Mon Sep 17 00:00:00 2001 From: timofey Date: Fri, 30 Dec 2022 09:49:56 +0000 Subject: [PATCH] explicit raise from --- v6d0auth/app.py | 4 ++-- v6d0auth/client.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/v6d0auth/app.py b/v6d0auth/app.py index 25e48d7..e805ff3 100644 --- a/v6d0auth/app.py +++ b/v6d0auth/app.py @@ -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) diff --git a/v6d0auth/client.py b/v6d0auth/client.py index 4d37fc2..eb8f7a2 100644 --- a/v6d0auth/client.py +++ b/v6d0auth/client.py @@ -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):