mirror of https://github.com/tiangolo/fastapi.git
🔊 Log body parsing errors
This commit is contained in:
parent
b763a44328
commit
9a6fcdd13c
|
|
@ -1,6 +1,6 @@
|
|||
"""FastAPI framework, high performance, easy to learn, fast to code, ready for production"""
|
||||
|
||||
__version__ = "0.1.4"
|
||||
__version__ = "0.1.5"
|
||||
|
||||
from .applications import FastAPI
|
||||
from .routing import APIRouter
|
||||
|
|
|
|||
|
|
@ -10,9 +10,10 @@ try:
|
|||
from pydantic.types import EmailStr # type: ignore
|
||||
except ImportError:
|
||||
logging.warning(
|
||||
"email-validator not installed, email fields will be treated as str.\n" +
|
||||
"To install, run: pip install email-validator"
|
||||
"email-validator not installed, email fields will be treated as str.\n"
|
||||
+ "To install, run: pip install email-validator"
|
||||
)
|
||||
|
||||
class EmailStr(str): # type: ignore
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,8 @@ def get_app(
|
|||
body[field] = value
|
||||
else:
|
||||
body = await request.json()
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logging.error("Error getting request body", e)
|
||||
raise HTTPException(
|
||||
status_code=400, detail="There was an error parsing the body"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue