aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-06 15:21:51 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-06 15:21:51 +0530
commitade68ff6bf30d1462ea107d44b33377cef77ec33 (patch)
tree54c8c23a58408dde1e4ce531beb5a7d19b4ba352
parent2c2e1772b23bbd42b99eeedc854f4d7b723e59d1 (diff)
throw 404 code
-rw-r--r--app/apis.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/apis.py b/app/apis.py
index 4c6c3fe..f50d403 100644
--- a/app/apis.py
+++ b/app/apis.py
@@ -1,6 +1,6 @@
from api import app
from app import models
-from fastapi import Body, FastAPI
+from fastapi import Body, FastAPI, HTTPException
from fastapi.middleware.wsgi import WSGIMiddleware
from pydantic import BaseModel
@@ -14,7 +14,7 @@ async def API_User_Details(email: str):
try:
assert user != None
except AssertionError:
- return {"message": "User Not Found"}
+ raise HTTPException(status_code=404, detail="User Not Found")
return {
"first_name":user.first_name,
"last_name":user.last_name} \ No newline at end of file