auth support

This commit is contained in:
2019-09-11 02:51:55 +03:00
parent 39be8cebf1
commit 7de6a5fcc9
21 changed files with 471 additions and 14 deletions

View File

@ -8,7 +8,7 @@
#
import json
from aiohttp.web import Response
from aiohttp.web import HTTPException, Response
from typing import Any, Mapping, List
from .json import HttpEncoder
@ -23,6 +23,8 @@ def make_json(response: Any, args: Mapping[str, Any], code: int = 200) -> str:
def wrap_exception(exception: Exception, args: Mapping[str, Any], code: int = 500) -> Response:
if isinstance(exception, HTTPException):
raise exception # reraise return
return wrap_json({'message': repr(exception)}, args, code)